-
Notifications
You must be signed in to change notification settings - Fork 23
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
Namespaces / Nested translation keys #5
Comments
this is possible, although this can be a breaking change in the current state of it (you can put |
It can also be implemented as a non breaking change, but you may not want to do it like this if you consider it would be too confusing. Consider you have the key |
this approach would be too implicit and confusing IMO. |
We are working on some namespace system as well. However we don't think namespacing is a component issue; but a translator issue. We are doing this for the translate method:
Where Ui is a fallback namespace for the keys to be looked into. We are also using a "global" fallback. So a translations like this: Maybe this can be implemented? |
I'd be looking to do something like this, I'd refer to them as 'shared' translations, my example would be: translate([ 'Header', 'MenuItems' ])(Header)
/* ..and... */
translate([ 'Footer', 'MenuItems' ])(Footer) |
Hey @lloydwatkin This is exactly what we have settled on in our internal translator. Internally when the translate function is called, it fetches each of the "shared" translations and merges those objects. This is then passed to the translator. |
Would this work for you @bloodyowl, there wouldn't be a BC break since one is a string and the other an array? |
That PR accomplishes the original ask as:
However, it does not support pluralization or string expansion in that usage. |
Getting to the point where I require this functionality so have implemented here #13, does not break existing implementations and supports all required features. |
It sometimes makes sense to group different keys of a component under a namespace:
e.g.:
And accessing them like this:
The main selling points are expressiveness and reduced size for the translation json.
It's basically this angular-translate feature.
The text was updated successfully, but these errors were encountered: