16 Localization
chris edited this page 2020-11-05 20:30:24 +00:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This document explains how to localize TenFourFox and make a langpack installer. TenFourFox does not use regular Firefox language packs due to its different chrome storage format, but they are relatively straightforward to convert.

If you're interested in contributing a localization for your language, please see issue 328.

Summary of changes for 45 and the FPR series:

  • TenFourFox.dtd and TenFourFox.properties contain strings of features to be added to 10.4Fx at a later stage.
  • string TenFourFox does not support plugins for this content. has been moved to chrome/(language)/locale/(language)/pluginproblem/pluginproblem.dtd

Localization Guide

1. Things to have first

  • Existing recent Locale Installer app as an example to work with

  • GUItar application for compression/decompression (recommended)

  • Apple TextEdit with preferences set to open/save in UTF-8 (or MacRoman if your language characters are supported)

  • The TenFourFox version you want to localize

  • The official Intel Mac Firefox in your language corresponding to the 10.4Fx version (for example, if you are localizing 24, use the official Intel Mac Firefox 24). Please use the ESR version, not the regular release version.

2. The installer application

The installer application and script has already been developed to a stable point. File concerns with issue 328.

Rename your installer application with the correct language and version, e.g., TFF-24-langpack-(your language).app or the like so that people can see which exact version of 10.4Fx it is for, and which language the browser is changed to. Strings between minor versions of the browser (24.0.0->24.0.1, 38.0->38.2, etc.) are usually frozen, so the same installer app can be used; however, installers cannot work between major versions (for example, an installer for 38 cannot be used for 45).

The installer app package's Contents folder contains:

  • the tarball file for the supported versions of 10.4Fx that can be localized with this installer; see Tarball section below

  • osx_install.applescript (see AppleScript section)

  • /Resources/TFFlang.icns: You can change that to your country's flag in Photoshop or just use the generic 10.4Fx icon.

  • Info.plist: Change values inside according to the language you want to use. Note that CFBundleName is only correctly displayed in Mac OS X 10.5.

  • An executable named something like TenFourFox de, etc. (change name to your language code). This is the executable that starts bash and the AppleScript.

3. The tarball file

tarball.tar.bz2 has a compressed Contents folder. Don't confuse it with the installer application's Contents folder. Use OS X's built-in command line bunzip2 or GUItar.app to decompress. Note that the archive is secondarily compressed with bz2. This Contents folder contains the files that will replace the en-US locale originals in TenFourFox.app, or will be added to the originals:

Contents/Resources

/browser ->1)

/chrome ->2)

/chrome.manifest

/dictionaries ->3)

/(your language).lproj

chrome ->4)

chrome.manifest

defaults/preferences/firefox-l10n.js

(your language)/locale/...

(your language).manifest

(your language).aff

(your language).dic

(your language)/locale/...

(your language).manifest

To create the tar.bz2 archive, archive your Contents folder in tar, then compress your Contents.tar archive in bz2. You can use GUItar.app to do this. Rename it to tarball.tar.bz2.

4. The manifests

There are two chrome manifests: in Resources/browser and in Resources. In chrome.manifest one line must be changed: manifest chrome/en-US.manifest to your language. For your language, use fr (French), ru (Russian) and so on. Use a double name (en-US, en-GB, etc.) only when there are different country versions for the same language. Keep the language abbreviation consistent throughout the localization process, e.g. ru.manifest, ru folder in your folder tree, and so forth.

There are two manifests that need similar changes in Resources/browser/chrome and in Resources/chrome. Copy the two respective en-US.manifest files from 10.4Fx and rename to (your language).manifest. Inside change all strings accordingly.

Always use the original manifest files from the TenFourFox version you want to translate. Never copy them from the Intel version or any other version of the installer app, or otherwise you will run into trouble.

5. The dictionaries

Most languages in recent Firefox versions don't package the traditional dictionary files anymore (but TenFourFox does). You will have to extract those from an old copy of Firefox 3.6.x in your language or download them from Mozilla. Note that both the .dic file and the .aff files are necessary.

6. l10n.js

browser/defaults/preferences/firefox-l10n.js must be changed to your language. This is necessary so that browser extensions will speak your language if the programmer included them, otherwise they will stay English.

pref("general.useragent.locale", "(your language)");

7. (your language).lproj

This folder containing InfoPlist.strings is necessary to localize the Open/Print/Save dialogs correctly.

8. Localization strings taken from Intel Firefox

The localization strings are located within two folder trees within the TenFourFox application package: Contents/Resources/Chrome/(language) and Contents/Resources/browser/chrome/(language). Have a look at the en-US folders in 10.4Fx first. You will need some of the files and strings inside later. The installer script copies your language folder tree from the installer app to 10.4Fx, so that the browser will have the folders for en-US (inactive) and (your language) (active) in the end.

  1. Download the corresponding Intel version of Firefox and get the two omni.ja files from its application contents folder (Firefox uses a compressed jar format, while TenFourFox doesn't). Rename to omni.zip. Omnijars have a special zip format that Mac OS X itself might be unable to decompress. You can use the application GUItar for that.

  2. Recreate the en-US folder tree within TenFourFox in your language. Copy/replace all of them to your contents folder except the custom strings (if you're unsure, download an existing TenFourFox and a corresponding langpack installer and look inside).

    To edit the files, you can use Apple's TextEdit.app. Set Open and Save to UTF-8 in the preferences.

The folder trees are the hardest thing to make. Be prepared to spend some time. If your tree doesn't work at first, try copying only some new string files/folders at a time to see at which point it's messed up. Always verify that the edited files in the Firefox Intel version of your language, the TenFourFox version of your language and the TenFourFox en-US version are consistent.

9. TenFourFox custom strings

Some strings differ from the Intel Firefox version because we have our own update system and we don't support plugins.

  • browser/chrome/(language)/locale/browser/baseMenuOverlay.dtd (add Check For Updates... string in your language to the Intel file)

  • browser/chrome/(language)/locale/branding/brand.dtd, brand.properties: Tenfourfox instead of Firefox; look at the original TenFourFox file as an example and edit the Intel files accordingly, minus trademarkInfo in brand.dtd (<!ENTITY trademarkInfo.part1 " ">) Leave homePageSingleStartMain as is.

  • chrome/(language)/locale/(language)/mozapps/update/updates.dtd (manual update strings; edit the Intel file and translate and add these strings from the original TenFourFox file) (manualupdate2/3)

  • chrome/(language)/locale/(language)/pluginproblem/pluginproblem.dtd: <!ENTITY missingPlugin "TenFourFox does not support plugins for this content.">

  • chrome/(language)/locale/(language)/global/videocontrols.dtd: instead of <!ENTITY error.srcNotSupported "Video format or MIME type is not supported."> use <!ENTITY error.srcNotSupported "To play, ensure QuickTime Enabler is installed, then right-click and select Open Media in QuickTime."> in your language.

  • browser/chrome/(language)/locale/browser/TenFourFox.dtd and TenFourFox.properties contain strings of features to be added to 10.4Fx at a later stage. Copy these files over from 10.4Fx and translate the strings to your language.

  • browser/chrome/(language)/locale/browser/aboutDialog.dtd: this is TenFourFox's own dialog, so use that instead of the Intel Firefox version which is incompatible. Translate the strings (it's sufficient to translate the strings that are actually shown in TenFourFox; we don't use the update mechanism in the dialog).

  • browser/chrome/(language)/locale/(language)/devtools/client/storage.properties: Add the string table.headers.cookies.sameSite=sameSite

  • browser/chrome/(language)/locale/browser/browser.dtd: Add <!ENTITY JavascriptToggleCmd.label "Enable JavaScript"> in your language (after <!ENTITY loopMenuItem.accesskey…)

  • browser/chrome/(language)/locale/browser/browser.dtd: Add <!ENTITY toggleReaderMode.label "Toggle Reader Mode"> (leave English) <!ENTITY toggleReaderMode.key "R"> (after <!ENTITY showAllTabsCmd.accesskey "z">)

  • browser/locales/(language)/chrome/browser/browser.properties: Add # LOCALIZATION NOTE (reader-mode-button.tooltip): # %S is the keyboard shortcut for entering/exiting reader view reader-mode-button.tooltip=Toggle reader view (%S) in your language (after pasteAndGo.label=Paste & Go)

  • browser/chrome/en-US/locale/browser/browser.dtd add <!ENTITY mediaPlaybackRate050x2.label "Slow (0.5×)"> <!ENTITY mediaPlaybackRate050x2.accesskey "S"> <!ENTITY mediaPlaybackRate100x2.label "Normal"> <!ENTITY mediaPlaybackRate100x2.accesskey "N"> <!ENTITY mediaPlaybackRate125x2.label "Fast (1.25×)"> <!ENTITY mediaPlaybackRate125x2.accesskey "F"> <!ENTITY mediaPlaybackRate150x2.label "Faster (1.5×)"> <!ENTITY mediaPlaybackRate150x2.accesskey "a"> <!-- LOCALIZATION NOTE: "Ludicrous" is a reference to the movie "Space Balls" and is meant to say that this speed is very fast. --> <!ENTITY mediaPlaybackRate200x2.label "Ludicrous (2×)"> <!ENTITY mediaPlaybackRate200x2.accesskey "L"> in your language (and remove old mediaPlaybackRate labels and accesskeys if present)

10. The AppleScript

The script does the automatic replacing and re-writing in the TenFourFox application and the Firefox user profile. This script was originally taken and modified from the Open(Libre)Office langpack installer.

Note: In order to retain compatibility with 10.4 you can only use Mac OS Roman/ACSII characters; UTF 8 support was only added in 10.5. You should leave the installer script dialogs in English if the language you want to use cannot be displayed in Mac OS Roman characters.

Translate the UI strings to your language.

Also change the stated TenFourFox version(s) to the correct one(s) in:

  • set intro to

  • set TFFVersions to

Finally, change set Localeident to to your language.

The script does the following things:

  • Quits 10.4Fx if it's running

  • Looks for TFF application(s) installed and lets the user choose one if applicable

  • Checks if the browser version is correct (i.e., is one of the version(s) supported by this installer app)

  • Adds localization files to the browser app plus both (your language).manifest and the dictionaries

  • Replaces both chrome.manifests

  • Looks for user profile(s) in ~/Application Support/Firefox and writes general.useragent.locale set to your language.