From: Soren Stoutner <soren@stoutner.com>
Date: Thu, 3 Nov 2022 20:25:55 +0000 (-0700)
Subject: Enable per-app language support. https://redmine.stoutner.com/issues/910
X-Git-Tag: v3.12~11
X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=c7cea803670eae12c0d95afa8fb5b4dd180aac75;p=PrivacyBrowserAndroid.git

Enable per-app language support. https://redmine.stoutner.com/issues/910
---

diff --git a/app/build.gradle b/app/build.gradle
index e36ed768..ae0f7fa9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -30,6 +30,7 @@ android {
         targetSdk 33
         versionCode 60
         versionName "3.11"
+        resConfigs "en", "de", "es", "fr", "it", "pt-rBR", "ru", "tr"
     }
 
     buildTypes {
@@ -80,7 +81,7 @@ dependencies {
     implementation 'androidx.webkit:webkit:1.5.0'
 
     // Include the Kotlin standard library.  This should be the same version number listed in project build.gradle.
-    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10'
+    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20'
 
     // Include the Google material library.
     implementation 'com.google.android.material:material:1.7.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8d99e276..4cfa09bd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -58,6 +58,7 @@
         android:theme="@style/PrivacyBrowser"
         android:networkSecurityConfig="@xml/network_security_config"
         android:enableOnBackInvokedCallback="true"
+        android:localeConfig="@xml/locales_config"
         tools:ignore="DataExtractionRules,UnusedAttribute" >
 
         <!-- If `android:name="android.webkit.WebView.MetricsOptOut"` is not `true` then `WebViews` will upload metrics to Google.  <https://developer.android.com/reference/android/webkit/WebView.html> -->
diff --git a/app/src/main/res/xml/file_provider_paths.xml b/app/src/main/res/xml/file_provider_paths.xml
index d3af1279..ffbe1760 100644
--- a/app/src/main/res/xml/file_provider_paths.xml
+++ b/app/src/main/res/xml/file_provider_paths.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2018,2021-2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2018,2021-2022 Soren Stoutner <soren@stoutner.com>.
 
   This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
 
@@ -22,4 +22,4 @@
     <cache-path
         name="private-cache-directory"
         path="." />
-</paths>
\ No newline at end of file
+</paths>
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 00000000..8f71588f
--- /dev/null
+++ b/app/src/main/res/xml/locales_config.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2022 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+
+  Privacy Browser Android is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Privacy Browser Android is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Privacy Browser Android.  If not, see <http://www.gnu.org/licenses/>. -->
+
+<!-- https://developer.android.com/guide/topics/resources/app-languages#app-language-settings -->
+<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
+    <locale android:name="en"/>  <!-- English. -->
+    <locale android:name="de"/>  <!-- German. -->
+    <locale android:name="es"/>  <!-- Spanish. -->
+    <locale android:name="fr"/>  <!-- French. -->
+    <locale android:name="it"/>  <!-- Italian. -->
+    <locale android:name="pt-BR"/>  <!-- Brazilian Portuguese. -->
+    <locale android:name="ru"/>  <!-- Russian. -->
+    <locale android:name="tr"/>  <!-- Turkish. -->
+</locale-config>