`general.useragent.locale` is no more. All hail `intl.locale.requested`

708 views
Skip to first unread message

Zibi Braniecki (Gandalf)

unread,
Dec 5, 2017, 6:15:32 PM12/5/17
to firefox-dev, dev-platform
Hi all,

We just landed a major patch which replaces `general.useragent.locale` pref with a new pref `intl.locale.requested`.

Historically, `general.useragent.locale` has been widely used to set a locale for Firefox UI.

This year, we introduced a full new API called mozilla::intl::LocaleService which allows for setting and reading via setRequestedLocales and getRequestedLocales, respectively.

Behind some linting and checking, the API still used `general.useragent.locale` which limited us due to the nature of the pref and how it stored data.

With the change, we introduce a new pref - `intl.locale.requested`, which can be set in the same manner if needed, but can also handle a list of locales separated via `,` character and is validated to accept only well-formed BCP47 language tags [1] making our locale handling much more flexible and resilient.

This is one of the last major changes in the grand rewrite of how Gecko handles locales and language negotiation.

If you need to read/write the requested locales it is *highly* preferred that you use the (mozI)LocaleService API over reading/writing to the pref itself, but if you must, the code will be able to handle your change with grace.

Over last months we removed all direct writes/reads of the pref, so I hope there is nothing remaining, and we also introduced a migration code in nsBrowserGlue for 59 users, but if you happen to encounter a regression, please report it and CC me.

If you have any questions about it, let me know!
zb.

Mike Hommey

unread,
Dec 5, 2017, 6:48:15 PM12/5/17
to Zibi Braniecki (Gandalf), dev-platform, firefox-dev
Any change wrt intl.locale.matchOS?

Mike
_______________________________________________
firefox-dev mailing list
firef...@mozilla.org
https://mail.mozilla.org/listinfo/firefox-dev

Zibi Braniecki (Gandalf)

unread,
Dec 5, 2017, 7:01:26 PM12/5/17
to Mike Hommey, dev-platform, firefox-dev
Yes!
Thank you for bringing it up. I forgot to mention it in my original message.

We also removed `intl.locale.matchOS` and turned an empty `intl.locale.requested` to mean "use OS locales" [0].

zb.

Reply all
Reply to author
Forward
0 new messages