diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5ce1e249 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,67 @@ +Contributing To LOOT +==================== + +A general guide to contributing to LOOT, may be found on [LOOT's wiki](https://github.com/loot/loot.github.io/wiki/How-To-Contribute). Information more specific to this repository is found here. + +## Repository Branching Structure + +The repository branching structure is pretty simple: + +* The `master` branch is a ready-to-release branch. It will generally hold code newer than the latest release, but which could be prepared (ie. update version number, changelog) and packaged for release fairly quickly and easily. Code on this branch *should* be reasonably bug free and features will be complete. +* The `v0.7-alpha` branch is a next-release branch. It holds code that's working towards the next big release but which isn't there yet. Code is generally buggy and features incomplete (though this will vary considerably through the development cycle. After v0.7.0's release, this will be replaced with something a bit more generically named, probably `dev` or `next`. +* Other branches are generally themed on specific features or groups of changes, and come and go as they are merged into one of the two above, or discarded. + +## Getting Involved + +The best way to get started is to comment on something in GitHub's commit log or on the [issue tracker](https://github.com/loot/loot/issues) (new tracker entries are always welcome). + +Surprise pull requests aren't recommended because everything you touched may have been rewritten, making your changes a pain to integrate, or obsolete. There are only generally a few contributors at any one time though, so there's not much chance of painful conflicts requiring resolution, provided you're working off the correct branch. + +When you do make a pull request, please do so from a branch which doesn't have the same name as they branch you're requesting your changes to be merged into. It's a lot easier to keep track of what pull request branches do when they're named something like `you:specific-cool-feature` rather than `you:master`. + +## Translating LOOT + +### 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 this repository. All file paths given below are relative to its base folder. + +### 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 ""` line to the section with the headering `Languages`. `` 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//LC_MESSAGES/`, where `` 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 request if you wish. The files and functions which must be updated are given below. + +* In [helpers.h](src/backend/helpers.h), add a constant for the language to the `Language` class, and update `Language::Names()`. +* In [helpers.cpp](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](src/api/api.h) and [api.cpp](src/api/api.cpp). +* In [archive.py](src/archive.py), add the language folder to the inline list on line 68. +* In [installer.nsi](src/installer.nsi), add entries for the language folder to the install and uninstall sections. +* In [LOOT Metadata Syntax.html](docs/LOOT%20Metadata%20Syntax.html), add a row for your language to the Language Codes table. \ No newline at end of file