Merge pull request #1595 from krille-chan/krille/add-android-locale-config
build: Add locale config for android
This commit is contained in:
commit
59aa6beea5
4 changed files with 89 additions and 1 deletions
4
.github/workflows/integrate.yaml
vendored
4
.github/workflows/integrate.yaml
vendored
|
|
@ -9,6 +9,8 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- run: ./scripts/generate-locale-config.sh
|
||||||
|
- run: git diff --exit-code
|
||||||
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
||||||
- uses: subosito/flutter-action@v2
|
- uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
|
|
@ -76,7 +78,7 @@ jobs:
|
||||||
- run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }}
|
- run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }}
|
||||||
|
|
||||||
build_debug_ios:
|
build_debug_ios:
|
||||||
runs-on: macos-latest
|
runs-on: macos-15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:fullBackupContent="false"
|
android:fullBackupContent="false"
|
||||||
|
android:localeConfig="@xml/locale_config"
|
||||||
>
|
>
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|
|
||||||
54
android/app/src/main/res/xml/locale_config.xml
Normal file
54
android/app/src/main/res/xml/locale_config.xml
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<locale android:name="ar"/>
|
||||||
|
<locale android:name="be"/>
|
||||||
|
<locale android:name="bn"/>
|
||||||
|
<locale android:name="bo"/>
|
||||||
|
<locale android:name="ca"/>
|
||||||
|
<locale android:name="cs"/>
|
||||||
|
<locale android:name="de"/>
|
||||||
|
<locale android:name="el"/>
|
||||||
|
<locale android:name="en"/>
|
||||||
|
<locale android:name="eo"/>
|
||||||
|
<locale android:name="es"/>
|
||||||
|
<locale android:name="et"/>
|
||||||
|
<locale android:name="eu"/>
|
||||||
|
<locale android:name="fa"/>
|
||||||
|
<locale android:name="fi"/>
|
||||||
|
<locale android:name="fil"/>
|
||||||
|
<locale android:name="fr"/>
|
||||||
|
<locale android:name="ga"/>
|
||||||
|
<locale android:name="gl"/>
|
||||||
|
<locale android:name="he"/>
|
||||||
|
<locale android:name="hi"/>
|
||||||
|
<locale android:name="hr"/>
|
||||||
|
<locale android:name="hu"/>
|
||||||
|
<locale android:name="ia"/>
|
||||||
|
<locale android:name="id"/>
|
||||||
|
<locale android:name="ie"/>
|
||||||
|
<locale android:name="it"/>
|
||||||
|
<locale android:name="ja"/>
|
||||||
|
<locale android:name="ka"/>
|
||||||
|
<locale android:name="ko"/>
|
||||||
|
<locale android:name="lt"/>
|
||||||
|
<locale android:name="lv"/>
|
||||||
|
<locale android:name="nb"/>
|
||||||
|
<locale android:name="nl"/>
|
||||||
|
<locale android:name="pl"/>
|
||||||
|
<locale android:name="pt"/>
|
||||||
|
<locale android:name="pt"/>
|
||||||
|
<locale android:name="pt"/>
|
||||||
|
<locale android:name="ro"/>
|
||||||
|
<locale android:name="ru"/>
|
||||||
|
<locale android:name="sk"/>
|
||||||
|
<locale android:name="sl"/>
|
||||||
|
<locale android:name="sr"/>
|
||||||
|
<locale android:name="sv"/>
|
||||||
|
<locale android:name="ta"/>
|
||||||
|
<locale android:name="th"/>
|
||||||
|
<locale android:name="tr"/>
|
||||||
|
<locale android:name="uk"/>
|
||||||
|
<locale android:name="vi"/>
|
||||||
|
<locale android:name="zh"/>
|
||||||
|
<locale android:name="zh"/>
|
||||||
|
</locale-config>
|
||||||
31
scripts/generate-locale-config.sh
Executable file
31
scripts/generate-locale-config.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Directory containing the ARB files
|
||||||
|
l10n_dir="./assets/l10n"
|
||||||
|
# Target directory for the locale_config.xml file
|
||||||
|
xml_dir="./android/app/src/main/res/xml"
|
||||||
|
|
||||||
|
# Create the target directory if it does not exist
|
||||||
|
mkdir -p "$xml_dir"
|
||||||
|
|
||||||
|
# Output file name
|
||||||
|
xml_file="$xml_dir/locale_config.xml"
|
||||||
|
|
||||||
|
rm -rf "$xml_file"
|
||||||
|
|
||||||
|
# XML Header
|
||||||
|
echo '<?xml version="1.0" encoding="utf-8"?>' > "$xml_file"
|
||||||
|
echo '<locale-config xmlns:android="http://schemas.android.com/apk/res/android">' >> "$xml_file"
|
||||||
|
|
||||||
|
# Search for ARB files and extract language codes
|
||||||
|
for file in "$l10n_dir"/intl_*.arb; do
|
||||||
|
# Extract language code
|
||||||
|
language_code=$(basename "$file" | cut -d'_' -f2 | cut -d'.' -f1)
|
||||||
|
# Write language code to the XML file
|
||||||
|
echo " <locale android:name=\"$language_code\"/>" >> "$xml_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# XML Footer
|
||||||
|
echo '</locale-config>' >> "$xml_file"
|
||||||
|
|
||||||
|
echo "locale_config.xml file has been successfully created in the $xml_dir directory."
|
||||||
Loading…
Add table
Reference in a new issue