Firefox OS 本地化

1 位贡献者:


在本指南中,我们会告诉您如何简单的对 Firefox OS 进行本地化,尤其是 Gaia 接口和 apps。我们会从帮助您从配置电脑开始,继而描述如何本地化 Gaia 字符串, 最后介绍如何在您的工作中执行 l10n 测试。


为了能获得 Gaia 的源码并在您的电脑中测试本地化字符串, 您需要确保在电脑中已安装了下面的工具和语言:

GNU make
make 是一个有用的小工具,用来从源码中创建构建操作。当您准备好在电脑上进行 l10n 测试时,它就会排上用场。下载和安装 make 工具是非常简单的,可以直接借助 GNU 网站完成。 如果您在使用 Mac OSX, 则需要从  App Store 中安装 XCode 和 XCode's 命令行工具。
git 是一个版本控制系统,用来存储正在积极开发的 Gaia 源代码。下载和安装 git 是非常简单的,能够直接借助它们的网站来完成。
Python 是一种编程语言,将帮助您创建对 l10n 测试的 Firefox OS 构建过程。 下载和安装 Python 是非常简单的,可以直接通过它们的网站来完成。
Mercurial (hg)
Mercurial (hg) 也是一个版本控制系统, 会收藏稳定的 Gaia版本以用于 l10n, 本地仓库也是一样。 下载和安装 Mercurial 是非常简单的,能够直接通过 直接通过它们的网站来完成
compare-locales 是一个 Python 脚本,可以帮助本地化工作者评估它们的工作并将需要本地化的内容与已经本地化的内容分离(称之为 diff) 。 下载和安装 compare-locales 是非常简单的,可以  done 直接通过 compare-locales wiki 页面完成。请注意,如果您仅仅使用命令行或文本编辑器,该工具是必须的。如果您使用 pootel, Tansifex 或 Pontoon 等工具,则不需要使用它。



  1. 请在命令行下,进入您存储 Gaia 代码和本地化字符串的目录
  2. 使用 hg,  将 en-US 仓库 clone 到本地, 请使用下面的命令完成。
    hg clone
  3. 现在,使用带有下面结构的命令 clone 您的本地化仓库。下面例子中,第二行命令则是指将繁体中文 clone 到对应的文件夹中。 
    hg clone
    hg clone B2G/gaia/locales/zh-TW
  4. 现在运行下面的命令:
    LOCALE_BASEDIR=locales/ LOCALES_FILE=locales/languages_mine.json make

本地化文件会在 languages_mine.json 文件中列出,其结构如下所示:

  "en-US" : "English (US)",
  "fr" : "Français (fr)"

在此文件中,您应该有一个列表的字符串去翻译!请注意, 如果您开始对 Friefox OS 新的语言进行本地化,则不需要创建一个 diff, 因为所有的字符串都是新字串,都需要我们来翻译。

注意: 在本地构建自动化脚本时,请参考  这个要点 gist


翻译 Gaia 字符串

The workflow for translating Gaia strings largely depends upon the tools you're using to translate. This part of the process is similar to the regular translation phase for other Mozilla products. The Translation Phase page of the Localization Quick Start Guide contains a list of all the tools used to translate strings within Mozilla products along with tutorials on how to translate with those tools. This page will be useful to you whether you're part of a l10n team trying to decide what tool to use to translate Gaia strings or you're looking for the right tutorial for the tool your team currently uses.

Firefox OS L10n 测试

There are two main methods for performing l10n testing on Firefox OS: desktop builds and mobile builds. Currently, the desktop method is the most widely used method for l10n testing.

Desktop l10n testing

  1. Download and install the latest boot2gecko nightly desktop build by visiting downloading the package that corresponds to your operating system. Look for the packages that contain the word localizer in them. This indicates that the build has all of the locales listed on languages-all.json enabled.
  2. Clone the latest version of Gaia by navigating to the directory on your desktop where you would like it to download and entering this command in the command line utility: git clone git://
  3. If your team is localizing Firefox OS for the first time, you'll need to enable your locale. If not, grab yourself a drink while everyone else enables their locale.
    1. While in the command line, navigate inside your gaia clone and run this command to clone your locale's repo: hg clone ssh://
    2. Open the languages.json file located in the shared/resources directory in the gaia repository you just cloned.
    3. Add your locale information according to this format: "en-US" : "English (US)", and save the file.
    4. Finally, run the command: make multilocale This enables your locale on your desktop build.
  4. Create your Gaia profile by running this command: DEBUG=1 make -C gaia profile
  5. Finally, you can run Firefox OS with your locale profile and begin testing. Do this by entering this command: b2g/b2g -profile gaia/profile. If you're using Mac OS X, run this command: /Applications/ -profile gaia/profile
  6. To update your desktop builds, simply navigate to your Gaia repo clone and enter this command: git pull

Mobile l10n testing

This section will grow as more devices that support Firefox OS become available to localizers.

What to look for when l10n testing

Localization testing for a mobile operating system has some similarites to localization testing for a desktop application. Here are some guidelines on what to look for when performing localization testing on your work:

  1. See if your translations fit inside UI text elements.
  2. Ensure that the tone, style, and terminology are consistant throughout the entire product.
  3. Look for untranslated English strings in the UI. These may be hard-coded into Gaia or they may caused by element ID errors.
  4. Make sure that time and dates display according your regions standards.

发现本地化相关 bugs

Here are some links to bugzilla in order to give you examples of bugs that have been encountered while using the phones. This will give you an idea of where to look at for bugs as well as an example in filing these kinds of bugs.

General rules when filing a Localization bug:

  • if the bug is specific to the language, then file under the Mozilla Localization (under Other Products) and cc the localizer. Don't forget to flag your bug with the appropriate tracking flag
  • if it's not specific to the language, file under FirefoxOS Product, and cc the localizer. Don't forget to flag your bug with the appropriate tracking flag
  • If you are in doubt, file under FirefoxOS Product, and cc the localizer. Don't forget to flag your bug with the appropriate tracking flag

For those of you who use Moztrap, looking at the existing test cases under the FirefoxOS "localization" tags and seeing if you can pass the tests on your device is also a good way to test Firefox OS localizations.


Now you're ready to start localizing! So open up your favorite l10n tool and go for it! As always, if you have questions that are not covered in this document, please send them to the newsgroup.


向此页面作出贡献: ReyCG_sub
最后编辑者: ReyCG_sub,