From 104d8da655f8abfd88433716bfea2d16db4a8337 Mon Sep 17 00:00:00 2001 From: kadirkid Date: Wed, 7 May 2025 22:51:10 +0400 Subject: [PATCH] Switch per language support to manual The current automatic support setup has a bug where the app language will change for users with Android 15 when there is a configuration change like rotating a screen. It seems that that using generateLocaleConfig on AGP 8.8+ triggers a bug in Android 15 (android:defaultLocale) which causes this issue --- app/build.gradle | 66 ++++++++++++++++++++++++- app/src/main/res/resources.properties | 1 - app/src/main/res/xml/locales_config.xml | 59 ++++++++++++++++++++++ 3 files changed, 124 insertions(+), 2 deletions(-) delete mode 100644 app/src/main/res/resources.properties create mode 100644 app/src/main/res/xml/locales_config.xml diff --git a/app/build.gradle b/app/build.gradle index 8221b897a..2a3c802db 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,72 @@ android { arg('room.generateKotlin', 'true') } androidResources { - generateLocaleConfig true + generateLocaleConfig false } + resourceConfigurations += [ + "en", + "ab", + "ar", + "arq", + "as", + "be", + "bn", + "ca", + "cs", + "de", + "el", + "en-rGB", + "enm", + "es", + "et", + "eu", + "fa", + "fi", + "fil", + "fr", + "frp", + "gu", + "hi", + "hr", + "hu", + "in", + "it", + "iw", + "ja", + "kk", + "km", + "ko", + "lt", + "lv", + "lzh", + "ml", + "ms", + "my", + "nb-rNO", + "ne", + "nn", + "or", + "pa", + "pa-rPK", + "pl", + "pt", + "pt-rBR", + "ro", + "ru", + "si", + "sr", + "sv", + "ta", + "th", + "tr", + "uk", + "vi", + "zh-rCN", + "zh-rTW", + // Specific BCP 47 locales + "b+zh+Hans+MO", + "b+zh+Hant+MO" + ] } buildTypes { debug { diff --git a/app/src/main/res/resources.properties b/app/src/main/res/resources.properties deleted file mode 100644 index 467b3efec..000000000 --- a/app/src/main/res/resources.properties +++ /dev/null @@ -1 +0,0 @@ -unqualifiedResLocale=en-US diff --git a/app/src/main/res/xml/locales_config.xml b/app/src/main/res/xml/locales_config.xml new file mode 100644 index 000000000..b26cc38d0 --- /dev/null +++ b/app/src/main/res/xml/locales_config.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +