Skip to content

Commit

Permalink
create a normalized_app_language that will return the normalized loca…
Browse files Browse the repository at this point in the history
…le that we are using for the app
  • Loading branch information
frett committed Oct 4, 2023
1 parent 6f86c3b commit 430724f
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Settings internal constructor(private val context: Context, coroutineScope

// region Language Settings
var appLanguage: Locale
get() = AppCompatDelegate.getApplicationLocales()[0] ?: Locale.getDefault()
get() = Locale.forLanguageTag(context.getString(R.string.normalized_app_language))
set(value) {
AppCompatDelegate.setApplicationLocales(LocaleListCompat.create(value))
}
Expand Down
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-ar/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">ar</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-es/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">es</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-fr/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">fr</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-hi/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">hi</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-id/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">id</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-in/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">id</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-lv/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">lv</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-pt/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">pt</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-ru/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">ru</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-vi/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">vi</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-zh-rCN/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">zh-Hans</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values-zh-rTW/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">zh-Hant</string>
</resources>
4 changes: 4 additions & 0 deletions library/base/src/main/res/values/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normalized_app_language">en</string>
</resources>

0 comments on commit 430724f

Please sign in to comment.