Skip to main content

Translations

The project uses the library Lingui to translate the application and Crowdin to allow anybody to help translating the application.

Messages format

Messages in the Electron renderer process (UI/React) use the Gettext format (.po files) while messages in the Electron main process use a JSON format with explicit IDs.

While it would be better to use the Gettext format everywhere, we use a JSON format for the main electron process for the following reasons:

  1. Dynamic import of JS modules on Windows doesn't work when the file is located inside an Electron ASAR archive (at least when I tried it)
  2. We would have to do the compile step manually (.po to .js files)
  3. There are a few translations in the main process (tray icon, file menu...)

Crowdin synchronization

To keep in sync the repository with Crowdin translations, we use the Crowdin GitHub action.
It allows us to create a PR per language with latest translations done by translators and upload new translations to Crowdin based on the application source code.

  • Translations are uploaded when something is pushed to the main branch.
  • Translations are downloaded from Crowdin every 12 hours.
info

Workflows can also be triggered manually from GitHub but it's possible only from maintainers.

Adding a new language

Developer or maintainer steps

  1. The first step is to find the locale code.
    A locale code usually contains the language and optionally a region (country) separated by an underscore or dash character (example: en-US for English spoken in the United States).
    Languages may have multiple regions (en-US, en-GB, en-CA...).
    In most cases the differences are mainly in spelling or vocabulary that doesn't prevent people from different regions to understand each other.
    Because of that, we usually use the language code without the region when possible.
    You can find all locale codes here.
    If the local code contains only a language, you can use it as is.
    If the locale code contains the langage and the region, you have to decide if using only the language code is enough.
    For example, there are many regions for English (en-US, en-GB, en-CA...) but the application only support one English language en because the differences are not significant enough to justify multiple languages.
    At the opposite, the locales zh-CN and zh-TW are very different and we support both of them.
  2. Add the code in the UI Lingui config and main process Lingui config
  3. Add the code in the GitHub action matrix
  4. Add the code in the UI select options
  5. Add support for the language in the function getFnsLocale of the date picker component
  6. If the locale is composed of the language + region (example: zh-CN) add a mapping in the Crowdin conf
  7. Create a PR

Maintainer steps

caution

The following steps can be done only by a project maintainer.

  1. Go on Crowdin
  2. Add the new language from the dashboard
  3. Trigger a new Download translations job
  4. A new PR with new language files should have been created, review it and merge it