Translations
How to Translate Kanboard to a New Language
- Translations are stored in the directory
app/Locale
. - Each language has its own subdirectory, e.g., French is
fr_FR
, Italian isit_IT
, etc. - A translation is a PHP file that returns an
Array
with key-value pairs. - The key is the original English text, and the value is the translation in the corresponding language.
- French translations are always up to date.
- Always use the latest version (
main
branch).
Create a New Translation
- Create a new directory:
app/Locale/xx_XX
(e.g.,app/Locale/fr_CA
for French Canadian). - Create a new file for the translation:
app/Locale/xx_XX/translations.php
. - Use the content of the French locales and replace the values.
- Update the file
app/Model/Language.php
. - Test with your local Kanboard installation.
- Submit a pull request on GitHub.
Update an Existing Translation
- Open the translation file
app/Locale/xx_XX/translations.php
. - Missing translations are commented with
//
and have empty values. Fill in the blanks and remove the comments. - Test with your local Kanboard installation.
- Submit a pull request.
Adding New Translated Text in the Application
Translations are displayed using the following functions in the source code:
t()
: Displays text with HTML escaping.e()
: Displays text without HTML escaping.
Always use the English version in the source code.
Text strings use the sprintf()
function to replace elements:
%s
replaces a string.%d
replaces an integer.
Refer to the PHP documentation for all available formats.
Finding Missing Translations in the Application
Run the following command in a terminal:
./cli locale:compare
This displays all missing and unused translations. Add missing translations to the French locale and sync other locales (see below).
Synchronizing Translation Files
Run this command in your terminal:
./cli locale:sync
The French translation is used as the reference for other locales.