Difference between revisions of "Translations"

From PioneerWiki
Jump to: navigation, search
m (For mod developers: link to http://json.org/string.gif)
(For mod developers)
Line 36: Line 36:
 
Translations are [https://developer.chrome.com/extensions/i18n.html <tt>chrome.i18n</tt> JSON] files. The format is fairly simple - an table of tokens as keys, with values of a table with two keys, <tt>message</tt> and <tt>description</tt>. <tt>message</tt> is the text that will appear in the game, while <tt>description</tt> provides instructions for the translator that will be displayed in Transifex. [http://json.org/string.gif Here] is a useful chart showing how characters are interpreted.
 
Translations are [https://developer.chrome.com/extensions/i18n.html <tt>chrome.i18n</tt> JSON] files. The format is fairly simple - an table of tokens as keys, with values of a table with two keys, <tt>message</tt> and <tt>description</tt>. <tt>message</tt> is the text that will appear in the game, while <tt>description</tt> provides instructions for the translator that will be displayed in Transifex. [http://json.org/string.gif 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 <tt>en.json</tt> in your patch.
+
If you're submitting code that requires a new language you should only include <tt>en.json</tt>. Please tag @robn or @johnbartholomew in your pull request so they can create a new resource in Transifex and make sure a language update is done at merge. If you don't do this then you'll break the game for non-English users.
  
 
== For core developers ==
 
== For core developers ==
  
 
The <tt>core</tt> resource is magical. If you add a string to it, you also need to add it to <tt>LangStrings.inc.h</tt> and recompile. It will then be available as <tt>Lang::SOME_TRANSLATED_STRING</tt>.
 
The <tt>core</tt> resource is magical. If you add a string to it, you also need to add it to <tt>LangStrings.inc.h</tt> and recompile. It will then be available as <tt>Lang::SOME_TRANSLATED_STRING</tt>.

Revision as of 00:10, 3 March 2014

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 you should only include en.json. Please tag @robn or @johnbartholomew in your pull request so they can create a new resource in Transifex and make sure a language update is done at merge. If you don't do this then you'll break the game for non-English users.

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.