2 KiB
Managing translations
Right now we're using the resourceConfigurations
mechanism provided by the Android Gradle Plugin to limit which
languages are included in builds of the app.
See e.g. 176a520e86/app-k9mail/build.gradle.kts (L40-L48)
This list needs to be kept in sync with the string array supported_languages
, so the in-app language picker offers
exactly the languages that are included in the app.
Removing a language
- Remove the language code from the
resourceConfigurations
list inapp-k9mail/build.gradle.kts
. - Remove the entry from
supported_languages
inapp/core/src/main/res/values/arrays_general_settings_values.xml
.
Adding a language
- Add the language code to the
resourceConfigurations
list inapp-k9mail/build.gradle.kts
. - Add an entry to
supported_languages
inapp/core/src/main/res/values/arrays_general_settings_values.xml
. - Make sure that
language_values
inapp/core/src/main/res/values/arrays_general_settings_values.xml
contains an entry for the language code you just added. If not:- Add the language name (in its native script) to
language_entries
inapp/ui/legacy/src/main/res/values/arrays_general_settings_strings.xml
. Please note that this list should be ordered using the Unicode default collation order. - Add the language code to
language_values
inapp/core/src/main/res/values/arrays_general_settings_values.xml
so that the index in the list matches that of the newly added entry inlanguage_entries
.
- Add the language name (in its native script) to
Things to note
For some languages Android uses different language codes that typical translation tools, e.g. Hebrew's code is he on Weblate, but iw on Android. When writing automation tools, there needs to be a mapping step involved.
Weblate's code that might be relevant for this:
bdbc725b50/weblate/formats/base.py
More research and careful testing is necessary when automating any of these steps.