-
Notifications
You must be signed in to change notification settings - Fork 8
Handle short locale ids #120
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
base: master
Are you sure you want to change the base?
Conversation
My browser locale id is "it". In PCC config, the locale is named "it-IT". The two should match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/client/lib/cookieconsent.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All files under the src/client/lib/
directory belong to the orestbida/cookieconsent
library. We'd prefer not to modify these files directly to simplify future maintenance. If we edit this file, we’ll have to manually reapply changes after every library update.
Let's keep the contents of the src/client/lib/cookieconsent.js
file as is. We could include any new JavaScript code elsewhere.
Maybe there are better solutions, but the possible way seems to me to change the settings.languages object when settings.auto_language === "browser", so for ex. the "it-IT" key becomes only "it", since cookieconsent.js expects the key name to be exactly the same as the browser locale id. (for instance, I did not check other languages). The code is trivial, but it seems it has to be executed before the code from cookieconsent.js.
|
Hallo. I updated my branch to 1.8.0. |
My browser locale id, as reported by navigator.language, is "it".
In PCC config, the corresponding locale is named "it-IT", so the translation is not used and I always get the default "en" version.
I think that the two ids should match: when the requested language is "it", and "it-something" is available, it should be used.