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
R18n::Translated and Sinatra #30
Comments
As a follow-up, I am doing this, and it's not helping:
|
I found this in the comments in translated.rb: you must call i18n helper in Sinatra before use models. How do I call this helper, and when? |
It is old documentation. Now R18n use before filter to set I18n object. |
Why you call |
If I want to pick which locale to use for a specific request, what do I do
|
I think, I didn’t understand you :). If you want to set user locale manually use: R18n.set R18n::I18n.new('en', options.translations) If ou want to print to console user locale: p R18n.get.locales |
My problem is that my model will be translated correctly based on the locale
|
I had another Sinatra-R18n issue - sometimes translations are absent (as discussed in #20). |
@akzhan That's a shame - looks like I'll need to abandon this gem too |
I've got this issue too. If I go to the /en page, then go to the /fr, the translations are still in english. Once I reload the page, they're in french. I worked around it by settings the language manually using R18n.set. Not that much of an issue since it's a small 2 languages app but it could be a huge pain for a larger app. |
If you can fix translated locale by reload page, I think you have problem with caching, not with R18n. |
Possibly. I'm using a simple sinatra app and I have not enabled any caching unless It's done by default. It also happens in development mode. I would have looked into it but was too much in a hurry for this app. Maybe later! |
Maybe you can show me your app source, if it is small and open source? |
@ai You can use https://github.com/Undev/runit-man/tree/1.10.3 as typical open source Sinatra application that based on R18n. It can be runned without gem using P.S.: 1.10.3 is last R18n-based version so use this tag. |
I can't run it. :(
|
Almost 9 years, wow! Sorry, I'm going to close this issue: as I wrote earlier, I couldn't reproduce. If you still experience something similar, and especially if you can provide example — I'd be glad to re-open and resolve it. |
I have an api running on Sinatra that has active record models using R18n::Translated. I'm having some major consistency issues with this feature - sometimes the correct translation returns, sometimes it's english. Is there some way I can explicitly set the desired local when I instantiate one of these models?
Please help! I love this gem, and I would hate to re-architect my multi-lingual support.
The text was updated successfully, but these errors were encountered: