diff --git a/app/build.gradle b/app/build.gradle index 1ac604b8..8d716927 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,6 +11,10 @@ android { versionCode 75 versionName "1.7.2" + // only include full translations + // NOTE: keep in sync with locales_config.xml + resourceConfigurations += ["en", "ar", "de", "es", "in", "it", "ru", "tr", "uk", "zh-rCN"] + buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L" } @@ -44,10 +48,6 @@ android { } } - androidResources { - generateLocaleConfig true - } - externalNativeBuild { cmake { path file('src/main/jni/CMakeLists.txt') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7ab6b7ee..4e5c6fe0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -30,7 +30,8 @@ android:theme="@style/AppTheme" android:allowBackup="true" tools:replace="android:label" - tools:targetApi="m"> + android:localeConfig="@xml/locales_config" + tools:targetApi="tiramisu"> + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/languages.md b/docs/languages.md new file mode 100644 index 00000000..e48b7a2e --- /dev/null +++ b/docs/languages.md @@ -0,0 +1,18 @@ +To provide a consistent user experience, languages with missing translations are excluded from the app build. +Usually this means languages with 5% or more untranslated strings. Such languages may still be present in the resources folder, however they won't be usable by the users. + +The languages currently included into the app need to be specified in 2 places: + +- `resourceConfigurations` in `app/build.gradle`: specifies the folder names of the actual translations to include +- `app/src/main/res/xml/locales_config.xml`: specifies the locales which are displayed in the Android own language selector + +Note: the locale name in `locales_config.xml` can differ from the language specified in `resourceConfigurations`, see +https://developer.android.com/guide/topics/resources/app-languages#sample-config for some examples + +## Adding a new language + +Here is a summary of the steps needed to add a new language: + +1. The language translation first needs to be completed on [Weblate](https://hosted.weblate.org/projects/pcapdroid) +2. The language related commits are cherry-picked to `master`, and possibly squashed +3. `build.gradle` and `locales_config.xml` is updated as explained about