-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing attributes via getString #282
Comments
Thank you for opening an issue before submitting code :) Your timing is great; I've been thinking about making changes to
Once we implement this change, it will make sense to change |
I would also like to suggest using the my-react-component =
.label1 = Label 1
.btn-allow = allow
.btn-deny = deny …you can use // Probably worth abstracting it as MyLocalizedComponent
<Localized id="my-react-component" attrs={{label1: true, "btn-allow": true, "btn-deny": true}}>
<MyReactComponent />
</Localized>
In the longer term, we plan to relax this restriction. See projectfluent/fluent#117 and projectfluent/fluent#173. |
Ok, I will wait for the new identifier syntax then! I will leave this issue open in case you want to track it somehow. As for using At the moment I'm using react-intl with Fluent is the kind of crucial work that receives less attention than it should, so thanks for doing it! |
So how is this going to end up happening? |
@ImUrX A PR adding functionality to this to |
Right now, at least from looking at the source, I think there's no clean way to access attributes when using
getString
viawithLocalization
.Would it be too ugly to change
getString
so that it can also (optionally) return formatted attributes?I'm asking because I want to have the following setup:
Having this as input:
I want to be able to use it like this:
customLocalization
would be a HOC that stores the wrapped component name(
MyReactComponent
) and exposes thegetAttribute
function:The reason I want do to that is to avoid having to repeat component names in the translation files (e.g.:
MyReactComponent-label1
,MyReactComponent-btn-allow
, etc.)I could submit a pull request to change
getString
in the way I'm proposing, but before I do that I want to know if this too much of a corruption of the original design and shouldn't be done at all, or if I'm missing something and this is already possible.The text was updated successfully, but these errors were encountered: