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

Zibi Braniecki (Gandalf) zbraniecki at mozilla.com
Tue Dec 5 23:15:06 UTC 2017

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

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!

[1] https://tools.ietf.org/html/bcp47
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20171205/4df2aed9/attachment-0001.html>

More information about the firefox-dev mailing list