- How to Translate Mobileraker 🌐
Mobileraker supports multiple languages and relies on contributions to add new languages and keep existing translations up to date. We now offer two methods for contributing translations: using the Crowdin platform or the manual method via GitHub. This guide provides details on both approaches.
We've moved our localization process to Crowdin, which makes it easier for contributors to add and update translations.
- Visit the Mobileraker Crowdin project: https://crowdin.com/project/mobileraker-app
- Sign up for a Crowdin account if you don't have one.
- Select the language you want to translate or update.
- Start translating! You can suggest translations for untranslated strings or vote on existing translations.
- Your contributions will be reviewed and, once approved, will be automatically incorporated into the project.
When translating in Crowdin, you'll encounter various key formats. Here's how to interpret and work with them:
-
Simple Keys: These are straightforward text strings to translate. Example:
general.settings
might appear as "Settings" in English. -
Nested Keys: These represent a hierarchy in the YAML structure. In Crowdin, they appear with dots separating each level. Example:
printer.state.printing
might represent "Printing" under the printer state section. -
Interpolation: Keys with variables use curly braces
{}
. These should remain unchanged in your translation. Example:printer.progress_message: "Printing {}, {progress}% complete"
Your translation should keep{}
and{progress}
intact. -
Linked Translations: These use the
@:
syntax. In Crowdin, you'll see the full text to translate, but remember that part of it is linked to another translation. Example:error.retry_message: "@:general.retry_button Attempt failed, please try again."
Here,@:general.retry_button
will be replaced with the translation of thegeneral.retry_button
key.
When translating, ensure to maintain any special syntax (like {}
for variables or @:
for linked translations) in
your translated text. Crowdin's interface will help guide you through this process.
Using Crowdin is the preferred method for contributing translations as it provides a user-friendly interface and helps maintain consistency across translations.
While we encourage using Crowdin, you can still contribute translations manually if you prefer. Here's how:
All available language files can be found in the assets/translations
directory. Each file adheres to the BCP 47 (IETF
language tag) standard, consisting of a language code (e.g., 'en' for English, 'de' for German) and, if necessary, a
region or country code (e.g., 'zh-CN' for Chinese in mainland China, 'zh-HK' for Chinese in Hong Kong). These language
files are in the YAML format (.yaml
) to ensure easy readability and editing.
Within each file, key-value pairs are used for translation. The value associated with each key can be either another collection of key-value pairs or a string that contains the translation.
String values can take several forms:
-
Simple Text: For example,
translation_key: "I am a text to translate."
-
Text with Arguments: For example,
translation_key: "I am a text to translate in language {}."
-
Text with Linked Translations: For example,
translation_key: "@:example.hello User! How are you?"
. This means an already defined key is used within this new translation. In the example,example.hello
refers to another translation. -
Text with Linked Translations and a Modifier: For example,
translation_key: "@:example.hello:capitalize User! How are you?"
. Here, a linked translation is used, and a modifier (in this case,:capitalize
) is applied to the text.
To add a new and currently unsupported translation manually:
- Clone the repository.
- Make a copy of the
en.yaml
file and rename it in compliance with the BCP 47 standard. - Remove the
languages:
section from the copied file, as this should only be present in theen.yaml
file. - Translate either all or some of the values in the new language file.
- Add the new language to the lib/main.dart file in the
supportedLocales
section. - Add yourself to the contributors list in this file.
- Create a Pull Request (PR).
To edit an existing language file manually:
- Clone the repository.
- Make your desired changes in the language file.
- Add yourself to the contributors list in this file.
- Create a Pull Request (PR).
- 🇿🇦 Afrikaans, @DMT07
- 🇭🇰 Chinese Hong Kong, @old-cookie
- 🇨🇳 Chinese Mainland, @emo64, @ptsa
- 🇳🇱 Dutch, @JSMPI
- 🇬🇧 English, @Clon1998
- 🇫🇷 French, @Jothoreptile, Arnaud Petetin, @dtourde
- 🇩🇪 German, @Clon1998
- 🇭🇺 Hungarian, @AntoszHUN
- 🇮🇹 Italian, @Livex97
- 🇧🇷 Portuguese Brasil, @opastorello
- 🇷🇴 Romanian, @vaxxi
- 🇷🇺 Russian, @teuchezh
- 🇹🇷 Turkish, @larinspub
- 🇺🇦 Ukrainian, @iZonex
While both methods (Crowdin and manual) are available, we encourage using Crowdin for a smoother translation process and better consistency. However, we appreciate all contributions, regardless of the method used.
If you have any questions about the translation process, please feel free to open an issue on GitHub or reach out to the project maintainers.