Translations

From PioneerWiki
Revision as of 19:14, 11 January 2014 by Impaktor (talk | contribs) (For mod developers: link to http://json.org/string.gif)
Jump to: navigation, search

All text in Pioneer is translatable, and the game ships with several translations. Here's everything you need to know.

For translators

All our translations are managed through Transifex, a web-based translation service. To start writing translations, sign up there, and then take a look at the Pioneer project.

Changes to translations are automatically pulled into the master git repo twice per day, and from there to the builds when they're next run.

In Transifex you can subscribe to notifications for the languages or resources you're interested in. When new strings are added or modified, you'll be told about it.

If you want to translate Pioneer to an entirely new language, please open an issue on the tracker and someone will create the translation for you.

English is the canonical language for Pioneer. As such, you can't directly modify the english strings through Transifex. If you want to change those, you'll need to make the change in git and submit a pull request like normal.

Untranslated strings will use the value from the English version.

You can leave comments in Transifex to help out other translators. You'll also see any notes left by the developers to help you translate a particular string.

If you're a new translator and you'd like your name included in AUTHORS.txt, please let us know!

For mod developers

Each module gets its own translation resource, called module-foo.

To get at the strings for your module, do something like:

   local Lang = import("Lang")
   local l = Lang.GetResource("module-foo")

Then you can get at the string by its token:

   print(l.SOME_TRANSLATED_STRING)

While its possible to load multiple translation resources to share strings, its highly recommended that you don't do that. Stick to your own strings so that you don't have to track changes in other modules. Duplicates across resources are fine. Note that code that uses multiple resources won't be accepted into the main Pioneer repository unless you've checked it with a core developer first and it has a good reason.

Translations are chrome.i18n JSON files. The format is fairly simple - an table of tokens as keys, with values of a table with two keys, message and description. message is the text that will appear in the game, while description provides instructions for the translator that will be displayed in Transifex. Here is a useful chart showing how characters are interpreted.

If you're submitting code that requires a new language resource, please make a note of it in your pull request, and only include en.json in your patch.

For core developers

The core resource is magical. If you add a string to it, you also need to add it to LangStrings.inc.h and recompile. It will then be available as Lang::SOME_TRANSLATED_STRING.