L10n:Localizing Overview

From MozillaWiki
Jump to navigation Jump to search

Breadcrumb: Main Page :: L10n:Home Page :: L10n:Localizing Overview

Overview

The object of localization is to translate an application's menus, dialogue boxes, labels and other settings (font, character encodings, dictionaries, default search engine etc) for a particular locale.

The Basics of Localization

The user interfaces (UIs) of Firefox, Thunderbird, the Mozilla Application Suite and Sunbird/Calendar are constructed using XML User Interface Language (XUL). This is an eXtensible Markup Language (XML) dialect and it allows the form (layout), function, content (language) and appearance (theme) of the UI to be described in separate files.

Such separation allows applications built with XUL to be localized relatively easily. All the text of the UI is held in DTD and Java-style .properties files. These text files link a token used in a XUL file to the actual string to be displayed. So, for example, the following XUL fragment is from am-main.xul:

<caption label="&<b class="token">identityTitle.label</b>;"/>
<description>&<b class="token">identityDesc.label</b>;</description>

and corresponds to the following fragment from am-main.dtd:

<!ENTITY <b class="token">identityTitle.label</b> "Identity">
<!ENTITY <b class="token">identityDesc.label</b> "Each account has an identity, which is the ↵
↳ information that other people see when they read your messages.">

where the "↵ ↳" indicates a single line, broken here for readability.

By altering the DTD file, you change the text displayed within the application.

How to begin a localization

The following steps should give you an idea of how to localize Firefox, Thunderbird etc.

if you want to contribute your localizations back to the MLP, head over to the registration page. From there, you can check whether anyone is already producing localizations for your intended language, and either join them or register yourself for one of the projects.

Localize the files

To do this, you can use all-in-one tools or your favourite UTF-8–aware text-editor. See Tools for more information.

Ensure you translate the directory structure (from ../en-US/.. to ../ab-CD/..) as well.

Package your localization

This step applies to all localisations that aren't held in CVS.

See Packaging your Work – however, note that when ZIPping your files, you should use no compression at all:

zip -r0 ''<file.jar> <dir>''

(Note, however, the directory structure used as an example in this document is obsolete.)

Re-package the new installer

This step applies to all localisations that aren't held in CVS.

The basic plan of action is to take the original (en-US) installer and replace its en-US parts with your newly-localised ab-CD parts. However, you must also tell the installer to use these ab-CD parts, not the en-US ones. Additionally, you should localise the installer itself.

All the installers use config.ini and install.ini. Building a Mozilla Suite Localised Installer gives an account of the process involved in updating these two files when creating a new installer. It is based on using mozip, but is applicable to all installers that use config.ini/install.ini.

when testing a 7z-based installer, use a faster compression ratio rather than one geared for smaller installer files. Only when you have checked that the installer works correctly should you recompress for minimum size.

For the smallest possible installer, ensure that none of the archive files within the installer (eg XPI files) are compressed; then use the following command:

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

This assumes that you are in the directory with all the necessary files, and the archive will be put in a sub-directory called stage/.

...(tbc)

Links