Destroyed Translating LOOT (markdown)

This commit is contained in:
WrinklyNinja
2014-08-27 14:50:30 -07:00
parent a63d51b523
commit 420f2678aa
-48
View File
@@ -1,48 +0,0 @@
Are you interested in contributing new or updated translations for LOOT? If so, you've come to the right place.
First of all, if you haven't already read it, [[How To Contribute|How-To-Contribute]] provides a general introduction to contributing to LOOT, including how to get set up. Once you're happy that you know what's what, continue on below.
### General Information
LOOT supports translation into other languages, with the following limitations:
* Debug log messages and error messages generated by the libraries LOOT uses cannot be translated.
* Masterlist messages can be translated, but translations must be submitted to the masterlist maintainers for addition. Translating masterlist messages won't be covered here.
* The languages LOOT supports is hardcoded, so LOOT must be updated to include new translations.
To translate everything but masterlist messages, first fork the [source code repository](https://github.com/loot/loot). All file paths given below are relative to the base folder of that repository.
### Translating the Installer
1. Open the installer script at `src/installer.nsi` in a text editor of your choice.
2. The English strings are located in the section with the heading `English Strings`. Create a copy of this section below the original.
3. Translate the quoted strings in the copied section, replacing the English text. For the lines beginning `VIAddVersionKey`, only translate the second quoted string.
4. Add an `!insertmacro MUI_LANGUAGE "<name>"` line to the section with the headering `Languages`. `<name>` is the NSIS name for your language: a perhaps incomplete example of accepted values can be found in [this script](http://nsis.sourceforge.net/Examples/Modern%20UI/MultiLanguage.nsi).
3. Save your changes.
### Translating the LOOT application
1. Download and install the latest version of [Poedit](http://www.poedit.net/).
2. If you are starting a new translation, select `File->New catalogue from POT file...` and choose the template file at `resources/l10n/template.pot`. In the `Catalog properties` dialog, just click `OK` without changing anything.
3. If you are updating a previous translation, open in Poedit the `loot.po` translation file in the relevant subdirectory of `resources/l10n`, then select `Catalogue->Update from POT file...` and choose the template file you downloaded. Click `OK` in the `Update summary` dialog.
4. Edit the translation file to add or update translations of the programs' text. Strings that were added since the last translation are displayed in bold and dark blue, and strings you have edited the translations of are marked with a star to the left of their source text in the main list.
5. Save the translation file with the filename `loot.po` in `resources/l10n/<locale>/LC_MESSAGES/`, where `<locale>` is your language's locale code.
Some languages may use different words or phrases for different contexts where only one word or phrase may be used for all contexts in English. While no contextual information is supplied to translators by default, it can be added on request. To request the addition of contextual information to a text string, create an issue for your request in LOOT's [source code issue tracker](https://github.com/loot/loot/issues), quoting the string for which you are requesting contextual information.
Some strings to be translated may contain special characters. Different types of special character that may be encountered are:
* Backslashes (`\`) must be escaped using another backslash, so if you wanted to display a single backslash `\`, you would put `\\` in your translated string.
* Double-quotation marks (`"`) must be preceded by a backslash, ie. `\"`, or LOOT will crash when it tries to display the string.
* Formatting placeholders are used so that LOOT can substitute text or numbers that are generated at runtime into pre-made strings. They appear as a number surrounded by percentage signs, eg. `%1%`. If formatting placeholders are used in the untranslated string, they **must all** be present in the translated string, or LOOT will crash when it tries to display the translated string. Placeholders can be moved around so that the sentence makes grammatical sense in the target language.
### Adding A New Translation
If you're adding a new translation, LOOT's source code must be updated to recognise it. You can do this yourself and include the changes in your translation's pull requests if you wish. The files and functions which must be updated are given below.
* In [helpers.h](https://github.com/loot/loot/tree/master/src/backend/helpers.h), add a constant for the language to the `Language` class, and update `Language::Names()`.
* In [helpers.cpp](https://github.com/loot/loot/tree/master/src/backend/helpers.cpp), update `Language::Language(const std::string& nameOrCode)` and `Language::Construct(const unsigned int code)`.
* Add constants for the language in [api.h](https://github.com/loot/loot/tree/master/src/api/api.h) and [api.cpp](https://github.com/loot/loot/tree/master/src/api/api.cpp).
* In [archive.py](https://github.com/loot/loot/tree/master/src/archive.py), add the language folder to the inline list on line 68.
* In [installer.nsi](https://github.com/loot/loot/tree/master/src/installer.nsi), add entries for the language folder to the install and uninstall sections.
* In [LOOT Metadata Syntax.html](https://github.com/loot/loot/blob/master/docs/LOOT%20Metadata%20Syntax.html), add a row for your language to the Language Codes table.