diff --git a/.scripts/locales.py b/.scripts/locales.py
new file mode 100755
index 000000000..6d2443047
--- /dev/null
+++ b/.scripts/locales.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python3
+
+import subprocess
+import xml.etree.ElementTree as ET
+
+root = ET.parse("app/src/main/res/values/settings.xml").getroot()
+for e in root.findall("string-array"):
+ if e.get("name") == "locale_values":
+ locales = [x.text for x in e if x.text]
+ break
+
+locales = [
+ # e.g. de or es-rAR (not es-AR)
+ loc.replace("-", "-r") if "-" in loc and loc[loc.index("-") + 1] != "r" else loc
+ for loc in locales
+]
+
+res = ", ".join(f'"{loc}"' for loc in locales)
+sed = [
+ "sed",
+ "-i",
+ f"s/resourceConfigurations .*/resourceConfigurations += [{res}]/",
+ "app/build.gradle"
+]
+subprocess.run(sed, check=True)
+
+with open("app/src/main/res/xml/locales_config.xml", "w") as fh:
+ fh.write('\n')
+ fh.write('\n')
+ fh.write(' \n')
+ for loc in locales:
+ if loc != "en":
+ # e.g. de or en-AR (not es-rAR)
+ loc = loc.replace("-r", "-")
+ fh.write(f' \n')
+ fh.write('\n')
diff --git a/app/build.gradle b/app/build.gradle
index 1758fc5dd..daa04ec98 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -24,6 +24,8 @@ android {
vectorDrawables.useSupportLibrary true
multiDexEnabled true
+
+ resourceConfigurations += ["ar", "bg", "bn", "bn-rIN", "bs", "ca", "cs", "cy", "da", "de", "el-rGR", "en", "eo", "es", "es-rAR", "fi", "fr", "he-rIL", "hi", "hr", "hu", "in-rID", "is", "it", "ja", "ko", "lt", "lv", "nb-rNO", "nl", "oc", "pl", "pt", "ro-rRO", "ru", "sk", "sl", "sv", "tr", "uk", "zh-rTW", "zh-rCN"]
}
buildTypes {
@@ -81,11 +83,6 @@ android {
lintConfig file('lint.xml')
}
namespace 'protect.card_locker'
-
- androidResources {
- generateLocaleConfig true
- }
-
}
dependencies {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8680c5c49..f4b44180f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,7 +27,8 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ android:localeConfig="@xml/locales_config">
-
\ No newline at end of file
+
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..01c186d52
--- /dev/null
+++ b/app/src/main/res/xml/locales_config.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+