diff --git a/android/build.sh b/android/build.sh index 25b1b738c6..d0559e1f2c 100755 --- a/android/build.sh +++ b/android/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Build Keyman Engine Android and KMAPro ## START STANDARD BUILD SCRIPT INCLUDE diff --git a/resources/build/l10n/README.md b/resources/build/l10n/README.md index 1a9258bd2c..00036a375c 100644 --- a/resources/build/l10n/README.md +++ b/resources/build/l10n/README.md @@ -7,6 +7,6 @@ In order to incorporate those files into the Keyman platforms: 2. From git bash, run `./parse-crowdin.sh` with the specified platforms Platform options: `-all`, `-android`, `-common`, `-developer`, `-ios`, `-linux`, `-mac`, `-web`, `-windows` -This will extract `Keyman.zip` into `/crowdin/` and copy files to the respective platforms. +This will extract `/Keyman.zip` into `/crowdin/` and copy files to the respective platforms. TODO: Add parameter to select locales diff --git a/resources/build/l10n/parse-crowdin.sh b/resources/build/l10n/parse-crowdin.sh index 539833b103..42291d4330 100755 --- a/resources/build/l10n/parse-crowdin.sh +++ b/resources/build/l10n/parse-crowdin.sh @@ -41,20 +41,25 @@ function copy_file() { function process_android() { cd "$CROWDIN_ROOT" echo "Processing Android" - for locale in *; do - if [ -d ${locale} ]; then - echo "Found locale $locale" - if [ -f "$CROWDIN_ROOT/$locale/android/KMEA/strings.xml" ]; then - copy_file "$CROWDIN_ROOT/$locale/android/KMEA/strings.xml" "$KMA_ROOT/KMEA/app/src/main/res/values-$locale" + for crowd_locale in *; do + if [ -d ${crowd_locale} ]; then + echo "Found locale $crowd_locale" + + # If crowdin locale contains region, we need to prefix with "r" + # See: https://developer.android.com/guide/topics/resources/providing-resources#AlternativeResources + locale=${crowd_locale/-/-r} + + if [ -f "$CROWDIN_ROOT/$crowd_locale/android/KMEA/strings.xml" ]; then + copy_file "$CROWDIN_ROOT/$crowd_locale/android/KMEA/strings.xml" "$KMA_ROOT/KMEA/app/src/main/res/values-$locale" fi - if [ -f "$CROWDIN_ROOT/$locale/android/KMAPro/strings.xml" ]; then - copy_file "$CROWDIN_ROOT/$locale/android/KMAPro/strings.xml" "$KMA_ROOT/KMAPro/kMAPro/src/main/res/values-$locale" + if [ -f "$CROWDIN_ROOT/$crowd_locale/android/KMAPro/strings.xml" ]; then + copy_file "$CROWDIN_ROOT/$crowd_locale/android/KMAPro/strings.xml" "$KMA_ROOT/KMAPro/kMAPro/src/main/res/values-$locale" fi fi # For now, only handle the first locale. Remove this when we're ready for everything - exit + #exit done }