How do I install a language XPI globally and make it the default language?
I am using Firefox on unices and various Linux distributions (the less common ones). Installing Firefox is easy, but it is always in English. I get most of my interfaces (gnome, libreoffice, gimp, etc) in my preferred translation simply by setting the proper locale (export LANG=xy_XY.UTF-8) before starting Xorg. I found and downloaded my preferred language pack for firefox, which comes in an XPI archive. Opening that XPI file in Firefox (via an URL of file:///path/to/file/langpack.xpi) works smoothly, the translation gets installed under the user's own profile and it shows up in the add-ons (under the new category: Languages). Unfortunately, I still see no way in Firefox preferences to set this added translation as the default. Firefox still starts with the English interface. On SeaMonkey, there is a combobox on the Appearance panel that allows me to select the language of the interface from the list of installed/available languages. I cannot find such option on the panels of Firefox. So far, I had to install a language-changer add-on to be able to set the interface to my native locale. Even though my users never need to switch to any other locales. Q1., Once a language xpi is installed, how do I set the interface to use that language? Q2., How do I install the language xpi and make it the system-wide default, so that all my users see Firefox starting with the native (non-English) interface? I found a handful of description for Q2, but they appear to be outdated and do not work. These include the -install-global-extension argument to Firefox, placing the xpi file as it was downloaded into the "extensions" folder, placing the xpi file renamed to the extension ID into the "extensions" folder, unzipping the contents of the xpi into a subfolder of the "extensions" folder named as the extension ID. Please note, these attempts might have failed because I placed the extension NOT where it was supposed to go. The instructions refer to the global extension folder as <installation folder>/extensions, but on my system no such folder exists. Firefox seems to get installed into /usr/local/lib/firefox and there is no "extensions" subfolder there in. However, there is a "browser/extensions" subfolder, but placing my XPI there did not trigger any effect. Also, I manually created the "extensions" subfolder in /usr/local/lib/firefox and moved the xpi there (on various names, unzipped and in a whole) without the expected result. Any suggestion is very much appreciated! My goal is to install the firefox package, then run something from the command line resulting the non-English translation in the downloaded XPI becoming the system-wide default for all users. A step forward would be to know for certain where that "extensions" folder must be on my specific OS. How do I query that?
All Replies (4)
1. The extension must be renamed to its extension ID. This information is in the install.rdf file, which can be opened with a text editor. Look for the em:id line. For example, the French language pack is originally named fr.xpi but it must be renamed to langpack-fr@firefox.mozilla.org.xpi
2. <installation folder>/browser/extensions is the correct location.
3. Users will have to confirm the add-on installation.
4. You can switch the browser language by changing the general.useragent.locale preference. Lock this preference to switch the language for all users. Note that although language packs are restartless extensions, Firefox will probably have to be restarted once for the UI language change to take full effect.
You can create a /distribution/bundles folder in the Firefox installation folder and install the language pack(s) in that folder.
That way they are available for all profiles that are started via this application.
I'm using this method myself to have some language packs available for testing.
This may only work if you use the en-US Firefox version. You need to create a folder with the GUID of the extension as specified in the install.rdf file and extract the content of the file language XPI file to this folder. You can install the language pack yourself in a profile to get the correct folder name to be used in the /distribution/bundles folder and extract its content to this folder. You need to update the language packs yourself when Firefox updates, as Firefox can't do this.
See also:
- /questions/979577 I m trying to have language pack enabled by default for any new profile in firefox 25
- /questions/983367 How can I make general.useragent.locale variable
Extensions installed this way aren't visible in the Add-on manager.
Edeziri
Excellent. These guides got me as far as installing my preferred language pack, which gets added to the add-ons automatically (assuming the user says yes to the appearing question when Firefox is started). However, the GUI does not change unless the user enters "about:config" and changes the locale.
Is there a way to do this from the command line? I mean, changing the locale settings. And preferrably for all users. So even when new users get added and they start Firefox the first time, they see it appearing with the preferred locale and not in English.
You can lock the general.useragent.locale pref to a specific locale if you want to force users the use this locale.
lockPref("general.useragent.locale", "en-US");
The mozilla.cfg file is located in the Firefox program folder and has effect for all users and all Firefox profiles that are started via this Firefox program folder.
Use a mozilla.cfg file in the Firefox program folder to lock prefs or specify new (default) values.
Place a file local-settings.js in the defaults\pref folder where you also find the file channel-prefs.js to specify using mozilla.cfg.
pref("general.config.filename", "mozilla.cfg");
These functions can be used in the mozilla.cfg file:
defaultPref(); // set new default value pref(); // set pref, but allow changes in current session lockPref(); // lock pref, disallow changes
See: