Handle short locale ids#120
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.
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.