Currently l10n.js' use of navigator.languages only checks the first item in the array. So, if that language is not supported, it falls back to the default locale. For Loop, we want to be able to fallback down the languages list to find the first language code that is supported. I've already done a patch for loop, but want to contribute it back to gaia so that we can maintain consistent versions.
Created attachment 8545241 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/27172 This changes the code to iterate through the requested array (effectively coming from navigator.languages) to find the first supported locale. Also extends the unit test.
Comment on attachment 8545241 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/27172 Thanks for the patch Mark! Stas, can we do this on master?
Ping: Stas/Zibi, any chance we can move this forward?
Hi Mark, we will look into this but not sooner than in a week time. It's on my list, but we first need to calm down the waters around 2.2 landings. Sorry for the delay!
Comment on attachment 8545241 [details] [review] Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/27172 Thanks, Mark. Sorry I didn't review this earlier. I left two comments on github. r=me.
Staś, thanks for the review, I responded to one comment and updated the patch for the other. Can you do the merge of the pull request? I don't have access to the b2g repos (first patch on gaia!).
Master: https://github.com/mozilla-b2g/gaia/commit/ed41e8587bc474c883cb8c6ee38a9005bfc9d187 L20n.js: https://github.com/l20n/l20n.js/commit/0c9c439792e77cd61400a612e188829836749c39 Thanks again, Mark!
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.