Creating a localized Windows installer of SeaMonkey

Our toolbox

Preamble: not all of the programs listed below are necessary. Some of them are simply the ones I use because I like them, while others are scripts that I've created to speed up the work. You can in every case choose the program you prefer to do some operations, and you can also decide not to use any of my scripts and manually enter all of the commands by hand. It's your choice!

For this howto I'll use the Italian translation as an example, since I use it for my work.

  • SeaMonkey installer in Italian (latest version)
  • SeaMonkey installer in English (the one you want to make the translation of)
  • Italian langpack working with the English installer (it should be the same version, or at least a compatible one)
  • WinMerge (for comparison of old and new files)
  • 7-zip (to manage archives and to build the installer)
  • Package for installer creation (contains necessary files to build the installer and scripts to automate the whole process)
  • Scripts to automatize the translation process (contain necessary files to build the installer)

For your comfort, put the mozip.exe file (you can find it in the "package") in your Windows directory, so you can use it from the command window without having to write its path every time.

Before we can start, here are some conventions used in this howto:

  • [nv] - version number of SeaMonkey
  • [path] - replaces the string of a path
  • I'll write filenames in lowercase to beautify this howto, but uppercased filenames should remain as they are
  • When I say "console" I mean the DOS prompt. In Windows 98/Me you can find it in the Start menu; for later Windows version you just have to type "cmd" in the Run window

First steps

First of all, you have to create the folders where you'll place the installer files. Personally (and this choice is used in the batch files/scripts) I create the directory C:\sm which contains three folders:

  • {{ mediawiki.external('nv') }}eng which will contain all of the English files of the version you have to translate
  • {{ mediawiki.external('nv') }}ita which will contain the files of the latest Italian version
  • {{ mediawiki.external('nv') }} which will contain the Italian files of the version you want to create the installer for

To create the last one, you'll have to copy the folder with English files and rename it.

To fill the English folder with the necessary files, you have to put the English installer in the [nv]eng folder, open a console and type:

mozip -x [path]\seamonkey-[nv].en-US.win32.installer.exe

After the extraction completes, you can delete the installer.

To decompress the Italian installer, you just have to put it in its folder, right-click on it and from 7-zip options select Extract here.

Translate text files

You can start your work translating the two text files which are among the extracted files: install.ini and config.ini

The first one is the translation of the installer interface so, since it isn't changing nowadays, you just have to copy the old file in your language. Anyway, to be sure you're doing the right thing, check at least that the number of rows between the two file (eg., using WinMerge), is the same.

The second file contains the configuration of the installer for any given version of SeaMonkey, and you should be more careful while translating it. Open WinMerge and compare the old Italian file and the new English one: WinMerge will automatically highlight all of the differences.

Not all the strings have to be translated: you have to concentrate just on those which have the string "localize me" on the previous line. You'll notice that some strings have not been translated, even if there's written "localize me" in the line before: I've not forgotten them, but if you translate them, the installer won't work. Apart from these lines, you'll have to change every reference of en-US and US respectively in it-IT and IT; surely you'll be able to recognize them when you'll see them. WinMerge can help you in this task: you just have to select the Italian text from one of the semi-window and paste it on the other, replacing the English text.

WARNING: at line 191 (which is one of the lines to be translated), there's written the exact version number of the build you're translating. Pay attention, during copy & paste, to not overwrite the number!!!

Once you've finished to modify the text files, you can begin with the program components, represented by all of the xpi files. For our scope some of these files can be grouped, since for every group you have to do the same operations. Because of that, instead of explaining what to do for each xpi, I'll describe what to do for each group.

The langenus.xpi file

First of all you have to unpack the file: in the context menu, among 7-zip options select Extract to "[path]", which will create a folder named langenus.

You have to modify install.js in the "localize me" section and insert the Italian it-IT codes where necessary. You can use the old Italian file and WinMerge to see what to modify.

Now move to the end of the file, where the langpack chrome locale is registered: in the English version the additional components (Inspector, help and so on) are usually placed in the package. The Italian translations, instead, are all placed in the same it-IT.jar, so we have to add all chrome registrations here. Even in this case, probably you only need to copy all the strings from the old Italian file and put them in the new one (in this case WinMerge can help you, too).

To finish up your work on this file you'll have to change the jar files in the bin/chrome folder, replacing all en-*.jar files with the it-*.jar ones (you can find them in the Italian langpack).

Once you've finished your work, go back to the folder wich contains install.js and select the file together with the bin folder, then from the context menu select "Add to archive..." and from the opening window choose Zip as archive format and None as the compression level. If you want to make your work faster, in the Archive filed type "../langitit.xpi", in this way your xpi file will be put automagically in the main folder, otherwise you have to move the file by hand in the {{ mediawiki.external('nv') }} directory.

WARNING: when you create xpi and jar files for the installer, you absolutely have to set None as the compression level, for two good reasons:

  1. You won't slow down SeaMonkey execution once installed.
  2. The resulting installer will be smaller if you don't compress xpi files.

When you've done everything, you can delete the langenus.xpi file and its folder from the main directory.

The regus.xpi file

Even in this case, and all of the following, create the file own directory. After that, edit install.js strings under LOCALIZATION NOTE; WinMerge will help you in this case, too. In the bin/chrome folder replace US.jar with IT.jar taken from the Italian langpack. Replace the searchplugins with the ones taken from the langpack in the bin/searchplugins folder and all the files in bin/defaults with the equivalent Italian ones, renaming the folder from US to IT. Go back to the folder which contains bin and install.js and make the xpi file naming it regit.xpi. Remember to delete the regus.xpi file and its folder after finishing!

The deflenus.xpi file

Edit install.js strings under LOCALIZATION NOTE and replace files in bin/defaults with the Italian ones. Go back to the parent directory and make the xpi archive naming it deflitit.xpi. Again, remember to delete deflenus file and its folder.

The first group of file

You should apply the procedure explained here to these files: venkman, chatzilla, inspector, sroaming, reporter.

As I said before, while in the English langpack the optional components translation is placed in every single component, in a translated langpack all these translations are put in the main jar file. This means that now we have to delete translation files from every single component.

In the install.js file you have to delete locale registration. To do this you just have to comment the related row (adding // at the beginning) or delete it. E.g. in the venkman component:

// registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome","venkman.jar"), "locale/en-US/venkman/");

In the bin/chrome folder you have to open the jar file with 7-zip and delete the locale folder. When you've done it, you have to make the xpi again.

WARNING: Starting from here to the end, the name of the xpi file is the same before and after the operation you do. When you make the xpi file and go back to the main folder, remember to delete the file folder only and not the xpi file, or you will delete your work. Obviously, you have to pay attention only if you have used the trick of typing "../component.xpi" as the file name in 7-zip.

The second group of file

You should apply the procedure explained here to these files: browser, mail, xpcom, spellcheck, talkback and to the zip file seamonkeyuninstall.

These files don't contain a translation, so you don't have to edit anything. Anyway, to reduce final installer size, you have to unpack and then repack them, this time without compression. You just have to unzip every single component in its folder, select all files in the folder and then create the xpi (or zip) file again, using None as the Compression level.

The gre-win32-installer.zip file

This package contains the GRE (Gecko Runtime Environment) installer, and it works as a standalone installer. This means that when you've created its folder, you have to run "mozip -x" command to extract installer files and after that you can delete the installer. Starting from SeaMonkey 1.0.2 the Italian installer is made with the procedure described below, so you just have to use 7-zip extract option in the context menu to unzip the Italian one, to make the file comparision.

Just like for SeaMonkey installer, you have to translate both install.ini and config.ini, which follow the same rules given at the beginning of this guide. In the same way, you'll have to unzip all xpi and zip files and zip them again without compression.

Now, we have to make the localized GRE installer. If you want to follow the faster way, you can just use the grebuild.bat script that I've created, once you've adjusted the directory paths to suit your owns (you can open .bat files even with the notepad). You just have to do a few things by hand: you have to copy in GRE folder the two files named app.tag and 7zSD.sfx, then edit the first one and in the "Title" field write "GRE".

If you're masochist and you want to do everything by hand, I'll explain below what you've to do.

To make the installer you have to pack its files in a single archive first. Open a console, move to the folder which contains the GRE installer files and type:

[path]\7z a app.7z -t7z *.* -mx0

In this way you'll create an app.7z file which contains all of the file in the directory, so now you can delete them. At this point you have to copy in the folder the two files named app.tag and 7zSD.sfx, edit the first one as described before and then run this command:

copy /b 7zSD.sfx+app.tag+app.7z gre-win32-installer.exe

After doing this, you've made the new installer, so you have to delete all other files in the folder.

It doesn't matter which way you've followed, at this point you should have in the folder only the installer file. Now you have to create its xpi/zip file just like all other components and go ahead.

Let's create the installer!

Once you've finished packaging the GRE installer, it's time to prepare the SeaMonkey installer.

Even in this case, you can choose to use my script or to do everything by hand. In both cases the first thing to do (and it's the last one if you decide to use the script, too) is to put in C:\sm folder the two files app.tag e 7zSD.sfx and edit the first one writing in the "Title" field the string "SeaMonkey [nv]".

You can now run the smbuild.bat script and wait the installer to be created (remember to adjust the folder names in the script), or you can open a console and type, after moving to the {{ mediawiki.external('nv') }} directory, the following command:

[path]\7z a -t7z ..\app.7z *.* -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3

Once the zip process is finished, move to the parent directory and type:

copy /b 7zSD.sfx+app.tag+app.7z mozilla-[nv].it-IT.win32.installer.exe

et voilà, your installer is ready!

Tips, tricks & scripts

In this section I'll explain the use of all the scripts I didn't mention above, and I'll try to give you some tips coming from my experience.

  • gremozip.bat: this script runs the mozip command to extract GRE installer files in English. I don't know what about you, but I think it's a mess having to type directory and file names every time to execute commands, and usually all the names are quite long. With this script the only thing you have to do is to write down the right path for the file, which is a simple copy & paste in Windows, a thing that you can't easily do in a DOS.
  • smmozip.bat: it does the same things as the one before, but it's used to unpack the English SeaMonkey installer when you start your work.
  • When you can, you'd better use software like WinMerge to edit files: you'll do less mistakes, and you'll be able to do a simple copy & paste from the Italian file to the English one in the same window; moreover the prorgam leaves white rows when a file contains more rows in the middle than an other, in this way you'll find easy the right place to paste the text.
  • Always leave open both the old Italian installer folder and the new one you're working in. Unpack all files in both folders: in some cases you'll just need to copy-paste some files from one folder to the other and that's it. Moreover, when you've finished to work with a component, you can delete its equivalent of the old Italian installer: when there'll be no more files to delete, you'll have finished. It even helps remembering which files you've already done.

Automatize the operations

This guide explains the steps to follow to create an Italian installer for SeaMonkey. Even if following these steps let you understand what you're doing, it takes a lot of time to do them.

Once you've understood these steps, you can use scripts to speed up things. You can download the scripts you need from the toolbox list. To make them work, you have to configure the config.bat file (you can find more information inside the package).
The scripts are based on this guide, and they assume that your work path is C:\sm and that they're put in the \tools sub-folder.

Once run, the scripts will stop only to let the user translate the necessary .ini and .js files, opening them with WinMerge. To translate these files, you should follow what there's written in the above guide: you can just copy some of them, but you have to be very careful with others.

WARNING: these scripts speak Italian, but the readme and config.bat files have been translated to English, too, so you should understand everything you need to make them work.

 

Credits

Michele Dal Corso for having written the list of operations to do for the first time.

Giacomo Magnini for having written the first version of the guide for Mozilla Suite, for the help he gave me during my first attempt of creating an installer and for QA.

Francesco Lodolo for QA.

Domenico Zanella for having created the scripts for the automatic building.

Document Tags and Contributors

 Contributors to this page: teoli, RainerBielefeld, KLAPEK, Iacchi
 Last updated by: RainerBielefeld,