-
Notifications
You must be signed in to change notification settings - Fork 238
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
I18n localization works only for single language #150
Comments
Here's what I am doing to solve it, though I don't like it much:
Then, at the bottom of my layout, I added:
Not very elegant, but functional. Another approach would be create the translation files as described in the gem's documentation, but don't include them by default in the application.js file. Then, have a javascript include tag that references the locale after the include for the application.js file:
|
thanks for raising the issue - afaik, multi-language support has not been investigated for this gem, so I'm unable to offer you any other ideas |
In our app, we allow the user to switch between different translations. We were excited to see that recurring_select offers localization, but it appears that one for one language, that cannot be dynamically changed.
I believe this is because the gem is simple overwriting the $.fn.recurring_select.texts object. It only contains one set of translations, based on whatever file is being loaded last.
For example, I adding a spanish translation coffee file in the assets/javascripts/recurring_select folder called es.js.coffee
Then included this file in my application.js file after I include recurring_select.
This overwrites the values in the texts object, and all translations were then in spanish. This is fine if the only language you ever need is one. But if users can dynamically switch between languages, which works in the rails app out of the box, then this implementation won't work.
I'm not seeing anywhere in the code where different locales files are selected based on the current locales value (I18n.locale)
It seems to me that the current locales value would have to be set as an element's data value, or as a js value, on each request. And the recurring_select would pull the correct text values from master locales file using whatever is the current selected locale.
I'd be grateful for any suggestions on how to modify recurring_select to do this.
The text was updated successfully, but these errors were encountered: