fix(android): Update scripts

* Set base android build.sh to use bash
* Update parse-crowdin.sh to handle Android regions (prefix with `r`)
This commit is contained in:
Darcy Wong 2020-03-10 13:08:39 +07:00
parent cd5831b227
commit d87bc5d12f
3 changed files with 15 additions and 10 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Build Keyman Engine Android and KMAPro
## START STANDARD BUILD SCRIPT INCLUDE

View file

@ -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

View file

@ -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
}