Changing the Language of Firefox Directly From the Browser

Language Settings

In Firefox there are two main user facing settings related to languages:

  • Web content: when you visit a web page, the browser will communicate to the server which languages you’d like to see content in. Technically, this is done by sending an Accept-Language HTTP header, which contains a list of locale codes in the user’s preferred order.
  • User interface: the language in which you want to see the browser (menus, preferences, etc.).

The difference between the two is not as intuitive as it might seem. A lot of users change the web content settings, and expect the user interface to change.

The Legacy Chaos

While the preferences for web content have been exposed in Firefox since its first versions, changing the language used for the user interface has always been challenging. Here’s the painful journey users had to face until a few months ago:

  • First of all, you need to be aware that there are other languages available. There are no preferences exposing this information, and documentation is spread across different websites.
  • You need to find and install a language pack – a special type of add-on – from addons.mozilla.org.
  • If the language used in the operating system is different from the one you’re trying to install in Firefox, you need to create a new preference in about:config, and set it to the correct locale code. Before Firefox 59 and intl.locale.requested, you would need to manually set the general.useragent.locale pref in any case, not just when there’s a discrepancy.

The alternative is to install a build of Firefox already localized in your preferred language. But, once again, they’re not so easy to find. Imagine you work in a corporate environment that provides you with an operating system in English (en-US). You search the Web for “Firefox download”, and automatically end up on this download page, which doesn’t provide information on the language you’re about to download. You need to pay a lot of attention and notice the link to other languages.

If you already installed Firefox in the wrong language, you need to uninstall it, find the installer in the correct language, and reinstall it. As part of the uninstall process on Windows, we ask users to volunteer for a quick survey to explain why they’re uninstalling the browser, and the amount of them saying something along the line of “wrong language” or “need to reinstall in the right language” is staggering, especially considering this is an optional comment within an optional survey. It’s a clear signal, if one was ever needed, that things need to improve.

Everything Changes with Firefox 65

Fast forward to Firefox 65:

We introduced a new Language section. Directly from the General pane it’s now possible to switch between languages already available in Firefox, removing the need for manually setting preferences in about:config. What if the language is not available? Then you can simply Search for more languages… from the dropdown menu.

Add your preferred language to the list (French in this case).

And restart the browser to have the interface localized in French. Notice how the message is displayed in both languages, to provide users with another hint to the user that they selected the right language.

If you’re curious, you can see a diagram of the complete user interaction here.

A lot happens under the hood for this brief interaction:

  • When the user asks for more languages, Firefox connects to addons.mozilla.org via API to retrieve the list of languages available for the version in use.
  • When the user adds the language, Firefox downloads and installs the language pack for the associated locale code.
  • In order to improve the user experience, if available it also downloads dictionaries associated with the requested language.
  • When the browser is restarted, the new locale code is set as first in the intl.locale.requested preference.

This feature is enabled by default in Beta and Release versions of Firefox. Language packs are not reliable on Nightly, given that strings change frequently, and a language still considered compatible but incomplete could lead to a completely broken browser (condition known as “yellow screen of death“, where the XUL breaks due to missing DTD entities).

What’s Next

First of all, there are still a few bugs to fix (you can find a list in the dependencies of the tracking bug). Sadly, there are still several places in the code that assume the language will never change, and cache the translated content too aggressively.

The path forward has yet to be defined. Completing the migration to Fluent would drastically improve the user experience:

  • Language switching would be completely restartless.
  • Firefox would support a list of fallback locales. With the old technology, if a translation is missing it can only fall back to English. With Fluent, we can set a fallback chain, for example Ligurian->Italian->English.

There are also areas of the browser that are not covered by language packs, and would need to be rewritten (e.g. the profile manager). For these, the language used always remains the one packaged in the build.

The user experience could also be improved. For example, can we make selecting the language part of a multiplatform onboarding experience? There are a lot of hints that we could take from the host operating system, and prompt the user about installing and selecting a different language. What if the user browses a lot of German content, but he’s using the browser in English? Should we suggest them that it’s possible to switch language?

With Firefox 66 we’re also starting to collect Telemetry data about internationalization settings – take a look at the table at the bottom of about:support – to understand more about our users, and how these changes in Preferences impact language distribution and possibly retention.

For once, Firefox is well ahead of the competition. For example, for Chrome it’s only possible to change language on Windows and Chromebook, while Safari only uses the language of your macOS.

This is the result of an intense cross-team effort. Special thanks to Zibi Braniecki for the initial idea and push, and all the work done under the hood to improve Firefox internationalization infrastructure, Emanuela Damiani for UX, and Mark Striemer for the implementation.

5 comments on “Changing the Language of Firefox Directly From the Browser”

  1. Dorah wrote on

    Thanks for your help, I can now add any language I want rather than having to install another version of the app. All thanks to you!!

  2. Fernando wrote on

    My firefox browser is a mess after the last update .
    I am in Brazil , but I always use my browser in english .
    But right now its half on English and half Portuguese , some times inside the same box .
    In options I have all set for English .
    How to fix this ?

    1. Francesco Lodolo [:flod] wrote on

      Comments in a blog post are not the best place to get support. There’s SUMO and Bugzilla. Having said that, take a look at this bug.

    2. Heidi wrote on

      I have the same problem. My OS (Windows 10) is in English as are all the other apps, but I’m in a German-speaking country. After painstaking searching and work, I got my Firefox to work in English before, and now I realize it’s messed up again. The browser options are in German, right-click options in German, and tab options a mix of English and German. The browser language settings do nothing because they were already set in English. I’m using Firefox Quantum, v. 68.0.

      1. Francesco Lodolo [:flod] wrote on

        Have you already tried the instructions available in the links in the comment before yours?
        https://support.mozilla.org/en-US/questions/1264272
        https://bugzilla.mozilla.org/show_bug.cgi?id=1564998#c4

        At this point I’m going to close the comments for this post. Please use SUMO to get support.