Labs/Ubiquity/Ubiquity 0.5 Command Localization Tutorial: Difference between revisions

 
(3 intermediate revisions by the same user not shown)
Line 25: Line 25:
<small>* almost every - see "shared keys" below.</small>
<small>* almost every - see "shared keys" below.</small>


Ubiquity's localization files for built-in commands are all stored in a central directory, and are organized by command feed. For example, the localization of the <code>firefox.js</code> command feed must be called <code>firefox.po</code> and is placed in the directory <code>ubiquity/localization/XX/</code>, where <code>XX</code> is your language's language code. For example, the Danish localization file for <code>firefox.js</code> would be stored as <code>ubiquity/localization/da/firefox.po</code>.
Ubiquity's localization files for built-in commands are all stored in a central directory, and are organized by command feed. For example, the localization of the <code>firefox.js</code> command feed must be called <code>firefox.po</code> and is placed in the directory <code>ubiquity/localization/XX/</code>, where <code>XX</code> is your language's language code. For example, the Danish localization file for <code>firefox.js</code> would be stored as <code>ubiquity/localization/da/firefox.po</code>. (For more information, see the "Testing your localization" section below.)


<code>po</code> files may be translated in a text editor or in specialized localization software. Some free tools include [http://www.poedit.net/ poEdit] and [http://en.wikipedia.org/wiki/Translate_Toolkit Translate Toolkit]. All Ubiquity <code>po</code> files are in UTF8 encoding. Traditional Gettext also uses a binary format called <code>mo</code> (machine object) but Ubiquity only uses <code>po</code> files.
<code>po</code> files may be translated in a text editor or in specialized localization software. Some free tools include [http://www.poedit.net/ poEdit] and [http://en.wikipedia.org/wiki/Translate_Toolkit Translate Toolkit]. All Ubiquity <code>po</code> files are in UTF8 encoding. Traditional Gettext also uses a binary format called <code>mo</code> (machine object) but Ubiquity only uses <code>po</code> files.
Line 31: Line 31:
== Localization templates ==
== Localization templates ==


<code>po</code> localizations are often started based on a <code>po</code> template or <code>pot</code> file. These templates are simply <code>po</code files with all blank <code>msgstr</code>'s.
<code>po</code> localizations are often started based on a <code>po</code> template or <code>pot</code> file. These templates are simply <code>po</code> files with all blank <code>msgstr</code>'s.


Ubiquity includes a handy localization template tool to create these initial templates for you. Just go to the Ubiquity command list, and click on the "get localization template" link next to a command feed. If no such link is showing up, it means that that feed was not bundled with Ubiquity and thus does not currently support localization.
Ubiquity includes a handy localization template tool to create these initial templates for you. Just go to the Ubiquity command list, and click on the "get localization template" link next to a command feed. If no such link is showing up, it means that that feed was not bundled with Ubiquity and thus does not currently support localization.
Line 120: Line 120:
   msgid "${number} result{if number > 1}s{/if} found."
   msgid "${number} result{if number > 1}s{/if} found."
   msgstr "找到${number}個結果"
   msgstr "找到${number}個結果"
== Testing your localizations ==
Manual testing is an important step in preparing your localizations. Testing requires you to place your <code>po</code> files in a specific language directory in your Ubiquity source folder. Where this folder is depends on how you obtained Ubiquity:
* '''for Ubiquity installs via xpi (addons.mozilla.com):'''
**If you installed Ubiquity via a packaged xpi, such as from addons.mozilla.com or from the "Add-ons" menu item in Firefox, your Ubiquity folder is in your Firefox profile. [http://support.mozilla.com/en-US/kb/Profiles This support tutorial] will tell you where to find your Firefox profile. Within your profile drill down to <code>extensions/ubiquity@labs.mozilla.com/</code>. This is your Ubiquity source folder.
* '''for Ubiquity installs from hg:'''
** If you pulled the Ubiquity source from our hg repository and installed it using the <code>manage.py</code> utility, you will find the Ubiquity source folder, <code>ubiquity</code> right in the root level of the repository.
Once you've found your Ubiquity source directory, you want to find your language's directory at <code>localizations/XX/</code> where XX is your language code. If the directory doesn't exist, you can make it. Place your <code>po</code> files there.
Finally, go to the Ubiquity settings page and make sure it's set to use your language (if you haven't already).* Restart to test out your localizations.
<small>* currently there's no way to test localizations for languages which do not yet have parsers for them. Read [[Labs/Ubiquity/Parser_2/Localization_Tutorial|this tutorial]] to learn more about how to write parser language settings for your language.</small>


== Contributing your localizations ==
== Contributing your localizations ==
308

edits