Difference between revisions of "Translations"
Philbywhizz (talk | contribs) (Imported from github wiki) |
|||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | Pioneer | + | 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 [http://transifex.com Transifex], a free web-based translation service. To start writing translations, sign up there, using [https://www.transifex.com/signup/open-source/?join_project=pioneer this link], and then take a look at the [https://www.transifex.com/projects/p/pioneer/ Pioneer project]. You can either use the web-interface, or download the full file, and edit off line, and then re-upload. | |
− | + | Changes to translations are automatically pulled into the master git repo, from transifex, 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 notified. | |
− | + | If you want to translate Pioneer to an entirely new language, please [https://github.com/pioneerspacesim/pioneer/issues 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 source code hosted in git and submit a pull request like for a normal code change. However, do note that changes in english text will trigger re-translation of that string in all other languages, thus there should be a good motivation why a string is changes (e.g. spelling/grammar). | |
− | + | 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 when you translate: Text within curly brace denote a varialbe name that will be substituted and should not be translated, e.g. | |
− | + | "Welcome to {system}" | |
− | |||
− | |||
− | |||
− | + | == For mod developers == | |
− | + | Each module gets its own translation resource, called <tt>module-foo</tt>. | |
− | |||
− | + | 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 [https://developer.chrome.com/extensions/i18n.html <tt>chrome.i18n</tt> JSON] files. The format is fairly simple - a JSON object with tokens as keys and values of an object 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. [https://www.json.org/img/string.png Here] is a useful chart showing how characters are interpreted. | |
− | + | If you're submitting code that requires a new language you should only include <tt>en.json</tt>. Please tag '''@impaktor''' 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 <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>. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 17:13, 30 June 2024
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 free web-based translation service. To start writing translations, sign up there, using this link, and then take a look at the Pioneer project. You can either use the web-interface, or download the full file, and edit off line, and then re-upload.
Changes to translations are automatically pulled into the master git repo, from transifex, 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 notified.
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 source code hosted in git and submit a pull request like for a normal code change. However, do note that changes in english text will trigger re-translation of that string in all other languages, thus there should be a good motivation why a string is changes (e.g. spelling/grammar).
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 when you translate: Text within curly brace denote a varialbe name that will be substituted and should not be translated, e.g.
"Welcome to {system}"
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 - a JSON object with tokens as keys and values of an object 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 @impaktor 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.