Various groups have been producing localised builds of Mozilla for a while, using piaip’s mozip tool. There is a guide which provides some instruction, but it’s a bit old and doesn’t have information on the newer options in mozip.
I finally decided to have a go at packaging a British English Mozilla installer. This wasn’t entirely straightforward, so I’ve written down a few notes so that
- I don’t forget how I managed it
- some other poor localiser might not fall into the traps I did
Ingredients:
- An official mozilla.org Mozilla monolithic installer.
- A matching language pack in XPI form.
- Optional extra XPIs:
- Region Pack.
- Defaults Pack.
- Spellchecker with Local Dictionary.
- piaip’s mozip tool (binary and source available).
- An NT-based installation of Windows (that’s NT4, NT5Win2000 or NT5.1WinXP).
Method:
Get a copy of the installer, the language pack and mozip.exe all in the same directory, and open a Command Prompt there.
Type mozip to get a list of parameters. You’ll see something like this:
C:\Mozinstaller>mozip mozip: A Mozilla Installer Zipper v0.2 Contact Hung-Te Lin <xxx@xxx.xxx.xxx.xxx> if you need help. Usage: [-u|x|t|d|h] <installer filename> <files [file1] [file2]...> -u: add/update files into the installer (Default action) -x: extract files inside the installer -t: test (list) files inside the installer -d: delete files inside the installer -h: This help message <installer filename>: name to use for the self-extracting executable <files>: file list to add/extract/delete to the self-extracing executable C:\Mozinstaller>
The first thing to do is extract -x the existing files:
C:\Mozinstaller>mozip -x mozilla-win32-1.5-installer-sea.exe Extracting Self-installer: mozilla-win32-1.5-installer-sea.exe Extract: 'BROWSER.XPI' Extract: 'CHATZILLA.XPI' Extract: 'CONFIG.INI' Extract: 'DEFLENUS.XPI' Extract: 'GRE-WIN32-INSTALLER.ZIP' Extract: 'INSPECTOR.XPI' Extract: 'INSTALL.INI' Extract: 'LANGENUS.XPI' Extract: 'LICENSE.TXT' Extract: 'MAIL.XPI' Extract: 'MOZILLAUNINSTALL.ZIP' Extract: 'REGUS.XPI' Extract: 'SETUP.EXE' Extract: 'SETUPRSC.DLL' Extract: 'SPELLCHECK.XPI' Extract: 'TALKBACK.XPI' Extract: 'VENKMAN.XPI' Extract: 'XPCOM.XPI' C:\Mozinstaller>
Next, delete -d the langenus.xpi from the installer:
C:\Mozinstaller>mozip -d mozilla-win32-1.5-installer-sea.exe langenus.xpi Removing File: 'LANGENUS.XPI': LANGENUS.XPI deleted. C:\Mozinstaller>
Then, add -u your language pack (langabCD.xpi) to the installer (NB: abCD is the language (ab) and country (CD) code for your language pack). In my case, this is langenGB.xpi:
C:\Mozinstaller>mozip -u mozilla-win32-1.5-installer-sea.exe langengb.xpi Adding File: 'LANGENGB.XPI': 475817/475624(un/compressed) bytes written C:\Mozinstaller>
If you have localised the Region Pack (regCD.xpi), the Default settings (deflabCD.xpi) and/or the Spellchecker (I recommend renaming the localised version to include abCD, eg spellcheck_abCD.xpi), then repeat the -d and -u steps for them.
Now comes the tricky (well, it was for me) bit – updating the two files config.ini and install.ini.
Tricky?―half-right, anyway
OK, install.ini is not tricky—not for seasoned translators—it’s just a fairly standard resource file for the installation wizard (the set of dialogues through which the user progresses) that requires translating.
On the other hand, config.ini controls how the installer copies files onto the system. However, it doesn’t just do that - a few of its text strings percolate out into the installation wizard.
Another fine mess youI’ve got me into
For config.ini, all you need to do is follow the ‘instructions’ contained within the file: every so often there’s a *** LOCALIZE ME BABY *** comment indicating that the following line requires localising. However, blindly following orders isn’t for me – besides, the comments aren’t applied entirely uniformly.
At or around line 223 of config.ini, the bundling instructions for the installer begin appearing. First, the “Browser Only” installation:
; List of components to install/enable for this Setup Type. ; All other components not listed here will be disabled if ; this Setup Type is selected. C0=Component XPCOM C1=Component GRE C2=Component Navigator C3=Component Uninstaller C4=Component US English Profile Defaults C5=Component En US lang pack C6=Component US region pack ; Make sure Component QFA is LAST so 3rd party developers who might not want ; this component can easily remove it. C7=Component QFA
The lines in bold, italic red refer to the localised (American English) components. These are repeated for the Complete and Custom installation Types. The strings after each Cx= are used later in the file as flags to describe which installations each set of chosen items will trigger. At or around line 689, the following listing appears:
[Component US English Profile Defaults]
Description Short=US English profile defaults
;*** LOCALIZE ME BABY ***
Description Long=US English profile defaults
Archive=deflenus.xpi
Install Size=384
Install Size System=1
Install Size Archive=7
Attributes=SELECTED|INVISIBLE|FORCE_UPGRADE
Force Upgrade File0=[SETUP PATH]\defaults\profile\bookmarks.html
Various items have been emphasised. Firstly, the string in square brackets, which exactly matches the string on the line beginning C4= above. I’m going to call this the internal descriptor. Then, short and long descriptions (only one of which is marked *** LOCALIZE ME BABY ***). Finally, the archive file.
Now, if you localise this file (which contains the first-run-time defaults for Mozilla) then you’ll probably change the name of the archive to deflabCD.xpi and the two description strings.
However, the internal descriptor absolutely must match the Cx= strings otherwise you don’t get the files copied (as I know from experience).
This rates around the “irritating” mark for default settings. However, if you mess with the internal descriptor of the language pack, and all of a sudden there’s no interface. “Oops” is an understatement. So, if you do this:
[Component EN GB lang pack] ;*** LOCALIZE ME BABY *** Description Short=English (UK) language pack ;*** LOCALIZE ME BABY *** Description Long=English (UK) language pack Archive=langengb.xpi ...
ensure you also alter the earlier installation lists to match like so:
; List of components to install/enable for this Setup Type. ; All other components not listed here will be disabled if ; this Setup Type is selected. C0=Component XPCOM C1=Component GRE C2=Component Navigator C3=Component Uninstaller C4=Component UK English Profile Defaults C5=Component EN GB lang pack C6=Component UK region pack ; Make sure Component QFA is LAST so 3rd party developers who might not want ; this component can easily remove it. C7=Component QFA
What Next?
Having worked this out in such short order (the installer’s worked on three PCs so far — I like Linus Torvald’s method of regression testing), the inquisitive British spirit begins to wonder what else might be achieved. As ever, a little bit of knowledge can be dangerous, but might just lead to learning a lot more, which is, of course, infinitely more dangerous.
[Part Two - Further Customisation is now available]