diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5c9f16a8..d6e26675 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -57,6 +57,7 @@
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:networkSecurityConfig="@xml/network_security_config"
+ android:localeConfig="@xml/locales_config"
android:theme="@style/KdeConnectTheme.NoActionBar"
android:name="org.kde.kdeconnect.MyApplication">
diff --git a/StaticMessages.sh b/StaticMessages.sh
index 4c8fba6a..11659712 100644
--- a/StaticMessages.sh
+++ b/StaticMessages.sh
@@ -22,6 +22,30 @@ function import_po_files # First parameter will be a path that will contain seve
# https://github.com/python-babel/babel/issues/566
find "$podir" -name '*.po' -exec msgattrib --no-obsolete -o {} {} \;
ANSI_COLORS_DISABLED=1 a2po import --ignore-fuzzy --android res/ --gettext $podir
+
+ # Generate the locales_config.xml
+ pushd res
+ echo '' > xml/locales_config.xml
+ echo '' >> xml/locales_config.xml
+ transform_locale_regex='(\w+)-r(\w+)'
+ # Add en-US as the first locale so that is the fallback, and also because it won't be handled in the following loop
+ echo -e '\t' >> xml/locales_config.xml
+ for i in values-*; do
+ if [ -d "${i}" ]; then
+ if [ -e "${i}/strings.xml" ]; then
+ locale="${i:7}"
+ if [[ "${locale}" =~ $transform_locale_regex ]]; then
+ # Special case to turn locales like "en-rUS", "en-rGB" into "en-US" and "en-GB"
+ transformed_locale="${BASH_REMATCH[1]}-${BASH_REMATCH[2]}"
+ echo -e "\t" >> xml/locales_config.xml
+ else
+ echo -e "\t" >> xml/locales_config.xml
+ fi
+ fi
+ fi
+ done
+
+ echo "" >> xml/locales_config.xml
+ popd
}
-
diff --git a/res/xml/locales_config.xml b/res/xml/locales_config.xml
new file mode 100644
index 00000000..4a69c554
--- /dev/null
+++ b/res/xml/locales_config.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+