3.0 KiB
Translations
How to translate Miniflux to a new language?
- Translations are stored inside the directory
locales
- There is a sub-directory for each language, by example for the French we have
fr_FR
, Italianit_IT
etc... - A translation is a PHP file that return an Array with a key-value pairs
- The key is the original text in english and the value is the translation for the corresponding language
- French translations are always up to date
- Always use the last version (branch master)
Plurals
Each translation file has a plural formula defined. This formula is used to determine wether a plural for the current number is needed. For languages with multiple plurals, the formula determine which plural form is the right one.
You can get the formula for your language from https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html.
The formula need to be adjusted to be valid php code. Do not hesitate to ask for an adjusted formula in the bugtracker.
You need to create a list of strings for terms that have a plural. For example the plural for the English translation looks like the following:
'plural' => function($n) { return ($n != 1); },
'After %d day' => array('After %d day', 'After %d days'),
Create a new translation:
- Make a new directory:
locales/xx_XX
by examplelocales/fr_CA
for French Canadian - Create a new file for the translation:
locales/xx_XX/translations.php
- Use the content of the French locale and replace the values
- Inside the file
models/config.php
, add a new entry for your translation inside the functionget_languages()
- Check with your local installation of Miniflux if everything is ok
- Send a pull-request with Github
How to update an existing translation?
- Open the translation file
locales/xx_XX/translations.php
- Missing translations are commented with
//
and the values are empty, just fill blank and remove the comment - Check with your local installation of Miniflux and send a pull-request
How to add new translated text in the application?
Translations are displayed with the following functions in the source code:
t()
: escaped HTML texttne()
: displayed with no escapingdt()
: date usingstrftime()
formats
Always use the english version in the source code.
How to find missing translations in the applications?
From a Unix shell run:
./scripts/find-strings.sh
All missing translations are displayed on the screen. Put that in the french locale and sync other locales (see below).
How to synchronize translation files?
From a Unix shell run this command:
./scripts/sync-locales.php
The french translation is used a reference for other locales.