From b2332c4452f145f4e3ac9a7c12d7f377e5cdc7a0 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 12 Sep 2015 18:33:25 +0200 Subject: [PATCH] Created Translation (markdown) --- Translation.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Translation.md diff --git a/Translation.md b/Translation.md new file mode 100644 index 0000000..7578e99 --- /dev/null +++ b/Translation.md @@ -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). \ No newline at end of file