feat: Per-app language preferences

This commit is contained in:
‭huajijam
2023-05-04 21:42:35 +08:00
parent 4f9ef060ea
commit fa793d764b
6 changed files with 26 additions and 2 deletions

View File

@@ -37,6 +37,8 @@ android {
/** 添加 App Center Secret 到 BuildConfig */ /** 添加 App Center Secret 到 BuildConfig */
buildConfigField('String', 'APP_CENTER_SECRET', "\"${getAppCenterSecret()}\"") buildConfigField('String', 'APP_CENTER_SECRET', "\"${getAppCenterSecret()}\"")
resourceConfigurations += ["en", "ja", "zh_CN", "zh_HK", "zh_MO", "zh_TW"]
} }
buildTypes { buildTypes {

View File

@@ -17,7 +17,8 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.AppErrorsTracking"> android:theme="@style/Theme.AppErrorsTracking"
android:localeConfig="@xml/locales_config">
<meta-data <meta-data
android:name="xposedmodule" android:name="xposedmodule"

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en"/> <!-- English -->
<locale android:name="ja"/> <!-- Japanese -->
<locale android:name="zh-Hans-CN"/> <!-- Chinese (Simplified) -->
<locale android:name="zh-Hant-HK"/> <!-- Chinese (Hong Kong) -->
<locale android:name="zh-Hant-MO"/> <!-- Chinese (Macau) -->
<locale android:name="zh-Hant-TW"/> <!-- Chinese (Taiwan) -->
</locale-config>

View File

@@ -35,6 +35,8 @@ android {
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
resourceConfigurations += ["en", "ja", "zh_CN", "zh_HK", "zh_MO", "zh_TW"]
} }
buildTypes { buildTypes {

View File

@@ -8,7 +8,8 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.AppErrorsDemo"> android:theme="@style/Theme.AppErrorsDemo"
android:localeConfig="@xml/locales_config">
<activity <activity
android:name=".ui.activity.MainActivity" android:name=".ui.activity.MainActivity"

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en"/> <!-- English -->
<locale android:name="ja"/> <!-- Japanese -->
<locale android:name="zh-Hans-CN"/> <!-- Chinese (Simplified) -->
<locale android:name="zh-Hant-HK"/> <!-- Chinese (Hong Kong) -->
<locale android:name="zh-Hant-MO"/> <!-- Chinese (Macau) -->
<locale android:name="zh-Hant-TW"/> <!-- Chinese (Taiwan) -->
</locale-config>