We are managing our translation using the service of Weblate: https://hosted.weblate.org/projects/matomo/. If you want to learn how to use translation in Matomo code or your plugins, check the developers guide.
If you have any feedback or questions regarding the translations, that aren't answered here, don't hesitate to get in touch with us at translations@matomo.org
Weblate is structured using Projects. We are currently having two projects to manage our different translations spaces:
Within the project it is possible to have components. We are using a component for each en.json that is located anywhere within Matomo or a plugin. Components can be managed by an admin.
Each component can be translated into each language that is available. The list of available languages is managed by the Matomo team. Users need to send a request for new languages. If the Matomo team decides to add a new language this needs to be done in the GitHub repo. See Adding a language for more details.
When we create a new plugin that contains its own en.json or a third party developer asks to get translations for his plugin, we create a new resource for this plugin. This can be done with the following steps:
+
in the top right cornerhttps://github.com/matomo-org/plugin-GoogleAnalyticsImporter.git
.JSON nested structure file
, Filemask lang/*.json
"Whenever a plugin is no longer available or discontinued we remove the component from Weblate, so translators don’t waste any time with translating texts that are no longer used.
Note: translations of removed plugins will still be stored in Weblate’s translation memory. If the same resource would be readded later, all translation would be automatically filled in again (if the text matches exactly).
Translations on GitHub are updated through automatic processes. Weblate maintains a fork of each repository where changes to translations are automatically commited. Once there are any changes they will be pushed and the Weblate bot will create a pull request to merge the updated translations.
Those translation PRs should be merged at least once a week, to avoid any merge conflicts in Weblate’s fork.
When a user requests a new language we need to add the language.
tzm
will be used. For
country variants of languages like es_AR
we format the language code using a dash and lowercase letters
like es-ar
.
For language codes including a country variant, we need to configure the language alias in Weblate. Otherwise new files
might be created with incorrect names. This can be done in the Weblate project settings > Workflow./lang/langcode.json
with the chosen language code in the main Matomo repository.General_Locale
specifying the PHP locale Matomo should set.
You can use /usr/share/i18n/SUPPORTED
on a Linux host for inspiration.
json
{
"General": {
"Locale": "es_AR.UTF-8"
}
}
If a translation is complete enough to be added to Matomo (maybe somewhere around 3-5% completion with most important base strings translated), it can be added to the [Languages]
section of config/global.ini.php
.
The following settings are changed from the default in the components. If you want to change settings in many components you can use and adapt mass-edit.py
which uses the Weblate API.
priority
)This can be set on a per-component basis to focus translators to the most important plugins in Matomo
manage-units
)This can be disabled as there should never be a reason to add new translation keys in Weblate.
check_flags
)php-format
: As Matomo uses printf
for translationssafe-html
: Checks if the translation doesn't use more HTML tags or attributes than the source stringignore-optional-plural
: The translation system of Matomo doesn't support pluralsenforced_checks
)["php_format"]
push_on_commit
)This is enabled, which means that whenever a change in Weblate is committed, a new pull request will be created or the existing one will be updated.
language_code_style
)We use "BCP style using hyphen as a separator" (bcp
) as it is the closest to the language code style used in Matomo
new_lang
)As a few steps need to be done to add a new language (see above), users can only request new languages, but don't add them. (contact
)
In addition, the following add-ons are added to components:
weblate.consistency.languages
)This component is project-wide and adds languages added to one component to all others.
weblate.cleanup.blank
)weblate.cleanup.generic
)Removes translation keys no longer in en.json
weblate.json.customize
){
"sort_keys": true,
"indent": 4,
"style": "spaces"
}
weblate.git.squash
){
"squash": "language",
"append_trailers": true,
"commit_message": ""
}
On https://matomo.org/translations we are showing which languages Matomo is available in, as well as a list of translators for each language. This list is actually created through a Matomo API request (LanguagesManager.getAvailableLanguagesInfo
). Therefore, the list of translators is stored within the base translations files (General_TranslatorName
).
Note: As the list is maintained in the translation files, the list on matomo.org will only be updated, once the translations have been update on GitHub, a new version was released and deployed.
The translations of the Intl plugin are automatically converted from the Unicode Common Locale Data Repository. To update them, check https://github.com/unicode-org/cldr-json/releases for the latest stable release of CLDR and update $CLDRVersion
in plugins/Intl/Commands/GenerateIntl.php
. Afterwards you can run php console translations:generate-intl-data
and commit the changed files in plugins/Intl/lang
.