Chapter 11 provides information about how to make a Mozilla application usable in many different languages. Localizing an application can be simple if your application is small. For large applications, though, localizing can be a long and complicated process. Fortunately, interested and enthusiastic developers created a tool that makes this process easier.
MozillaTranslator is a program written in Java that reads in a package, provides an interface for changing the strings, and when finished, repackages the files for distribution. It is sophisticated enough to read JAR archives and output cross-platform installers (XPI). This type of solution is ideal for nontechnical people who translate the interface strings.
MozillaTranslator is more than just a program for inputting translated strings. The web site (http://www.MozillaTranslator.org/) has resources for setting up projects, uploading language packs, and finding the latest news on localization issues among other features.
To get to the point at which you can input your translated strings, you need to take some introductory steps. After downloading and installing MozillaTranslator, follow these steps:
Select File > Manage Products.
Press Add in the dialog to add a package.
In the window that comes up, give the project a label (for your own use) and point to the chrome\en-US.jar file within your Mozilla build (replace the path with your own Mozilla application locale path).
Exit the dialog.
Select File > Update Product.
Select Edit > Chrome View once the update has finished. You should see the component structure shown in Figure B-4. You can then choose fields in which to view the chrome view window.
At this point, you can edit the text straight from the chrome view. Another option is to bring up an edit window for a selected phrase, which supplies all possible editable fields in one window. An advanced search feature exists if you look for a piece of text in multiple files. When your strings are all done, packaging and preparing your language pack for distribution is as straightforward as selecting the Export > Jar File/XPI Install from the menus.
MozillaTranslator has the adaptability to handle any application locale, once you point it at the correct resources. Make sure that your files are packaged in the correct format -- namely, a JAR file. MozillaTranslator can handle all localizable resources: DTDs, string bundles, HTML, and RDF files.