-
Notifications
You must be signed in to change notification settings - Fork 57
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
Internationalization of sub components #46
Comments
👍 I agree, I do have a common app behavior that holds the selected language but I need to load translation in each components and include an iron-signals based solution to manage the language changes - it was easier than passing language as a property all over. I'm not really sure what is best but maybe some solution based on a singleton could work - similar to i18next, which I use in another Polymer project. |
Hi, The app-localize-behavior should already be managed as a singleton according to the documentation and this code shouldn't be needed... But as this is not the case I have applied your idea of a behavior combined with iron-signal compo. Until someone can help me to work with this library as a singleton here is the solution I propose: app-localize-behavior (Polymer component):
main-app:
myapp-localize-behavior (extend app-localize-behavior):
myapp-page:
main-app:
myapp-localize-behavior:
myapp-page:
|
I had a similar solution but have some problems when the signal is been triggered before all the components are ready |
@notwaldorf is there a better way ? |
Hm.. why has this issue been closed although there is no real solution for using app-localize-behavior in a multiple component app? The current implementation is not usable for large projects. |
Re: @benj13260 . '...Sub-components should have language inherited' We've created a way to inherit the language based on the HTML standard The solution is based on our general purpose A Polymer 2.0 version is on its way too. |
Description
The documentation is explaining the following:
The main application is usually responsible for loading the localized messages and setting the current language.
Each element that needs to localize messages should also add the Polymer.AppLocalizationBehavior and use the localize method to translate strings, as shown above.
Expected outcome
Sub-components should have language inherited and the load of locales shouldn't be needed.
Actual outcome
This is not working as you can see in my test: https://github.com/benj13260/localize
The "language" property need to be passed to every sub-components
and
the instruction to load the locales file must be specified in each components (even if it doesn't actually load it, this command is required or the localize is not working).
The text was updated successfully, but these errors were encountered: