Closed Bug 1118444 Opened 6 years ago Closed 6 years ago

Check against all navigator.languages values for possible supported locales

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

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.
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.
Attachment #8545241 - Flags: review?(gandalf)
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?
Attachment #8545241 - Flags: review?(stas)
Blocks: 1118905
Ping: Stas/Zibi, any chance we can move this forward?
Flags: needinfo?(stas)
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.
Flags: needinfo?(stas)
Attachment #8545241 - Flags: review?(stas)
Attachment #8545241 - Flags: review?(gandalf)
Attachment #8545241 - Flags: review+
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!).
Flags: needinfo?(stas)
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
Closed: 6 years ago
Flags: needinfo?(stas)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.