Created Translation (markdown)

El RIDO 2015-09-12 18:33:25 +02:00
parent 7f621e6ea8
commit b2332c4452

28
Translation.md Normal file

@ -0,0 +1,28 @@
As of ZeroBin 0.21 translations are available and ZeroBin is no longer English only.
The translation concept follows similar concepts as GNU gettext:
- Each language has a translation file containing all its translated texts.
- As message IDs we use the original sentences in English. Therefore any untranslated messages will fall back to English and no English translation files need to be added.
- Plural forms are supported.
## Format
As ZeroBin has to provide a logic for both the server and the client side, the format of choice is JSON. You find these files in the directory `i18n`; They have to be accessible through the webserver.
Each translation file is saved under the name of the languages two-letter ISO code and contains one JSON object. The attributes of the object are the message IDs to be translated from English and the values stored in them are the translated strings.
## Dynamic values
Often a dynamic value should be inserted into the message. In these cases the message IDs will be ideally full sentences, as the position of these values might change in different languages. The dynamic values are marked by either `%s` for strings or `%d` for numbers in the message ID.
## Plural forms
Many languages use plural forms and some even more then one. For number dependent messages, an array of strings instead of a string can be set in the value of an attribute. Each language has a rule to decide which element from the array to use, given a certain number. Most languages will have the singular in the first position and the plural in the second. Here is an example for French:
{
[...]
"%d seconds": ["%d seconde", "%d secondes"],
[...]
}
Some languages can have more then one plural forms. Which form to use depending on a given number is [decided based on a formula](http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html).