Check against all navigator.languages values for possible supported locales

RESOLVED FIXED

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: standard8, Assigned: standard8)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
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.
(Assignee)

Comment 1

4 years ago
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.
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)
(Assignee)

Updated

4 years ago
Blocks: 1118905
(Assignee)

Comment 3

4 years ago
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+
(Assignee)

Comment 6

4 years ago
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
Last Resolved: 4 years ago
Flags: needinfo?(stas)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.