-
Notifications
You must be signed in to change notification settings - Fork 8
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
default_locale did not work #2
Comments
Maybe related to amberframework/amber#776 @docelic WDYT? 😅 |
Hello Jaysneg! @faustinoaq based on the description, I assume that the language files were not found, so the setting of "ua" was ignored and defaulted back to "en". But sure, let's handle #776 first and then we can see. I will submit a PR for #776 maybe even today. Thanks! |
@docelic Oh, ok 👍 BTW, WDYT about moving |
Sure, sounds good. Will be another PR. I'm working on it, sorry for the previous delay. Thanks! |
@jaysneg as a suggestion for you, please edit lib/citrine-i18n/src/citrine-i18n/handler.cr in your project and uncomment the lines that say: 13 #Amber.logger.debug "Languages available: #{languages.to_s}" Then, please observe the logs while you visit the page, and see whether "ua" appears in the list of available languages. Our further advice will depend on whether it does or not. Thanks! |
it works if i put this code to slang template
|
@docelic if i add this to initializers/i18n.cr it returns ["en", "ru", "ua"] |
it looks like it using javascript for setting this values |
01:34:57 Server | Languages available: en-US,en;q=0.9,ru;q=0.8,uk;q=0.7 |
but in src/locales 3 files |
@jaysneg right, the "Languages available" is somewhat misleading title. The values displayed there (along with q= preferences) come from the HTTP header Accept-Language which is sent by the browser. |
@jaysneg If I understand it right, the issue here is that the browser is instructing the server to prefer English over other languages, and since "en" is on the list of locales found by Amber, it is naturally chosen instead of the default_locale or other choices. (This may be somewhat inconvenient for users because users are typically given a choice of language in the web app, and are not used to the model where language preferences are taken from their browser's header Accept-Language.) Could someone confirm that that's what is happening and advise which path should be taken to solve it? |
my iphone default system language Ukrainian 03:31:25 Headers | Accept-Language: ["uk-ua"] file name uk-ua.yml and it did not change locale to uk-ua |
03:44:10 Headers | User-Agent: ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15"] in Safari |
03:44:59 Headers | Accept-Encoding: ["gzip, deflate, br"] system on Ukrainian |
@jaysneg ok, thanks for all the input. We're working on merging amberframework/amber#814 and then we can continue on this issue. |
Hey @jaysneg, the above issue was just merged so as soon as I get a chance I'll re-test the functionality from this issue and report back. Thanks! |
settings.default_locale = "ua" did not work
The text was updated successfully, but these errors were encountered: