mobile-ios/scripts/lokalise.sh

57 lines
1.5 KiB
Bash
Raw Normal View History

2020-08-03 06:01:39 +00:00
LOKALISE_TOKEN=$1
2021-12-10 08:05:42 +00:00
lokalise2 --token $LOKALISE_TOKEN --project-id 99670955616fccfa149649.92277036 file download --format strings --dest ../temp --unzip-to ../temp/locales
2020-08-03 06:01:39 +00:00
for directory in `find ../temp/locales -type d`
do
if [[ "$directory" == '../temp/locales' ]]; then
continue
fi
#get the language code to match iOS naming
language="$(basename "$directory")"
language=${language/.lproj/}
#if italian or greek remove anything after the -
if [[ "$language" == 'it-IT' || "$language" == 'el-GR' ]]; then
language=${language//\-[a-zA-z]*/}
fi
echo "parsing directory $directory"
for file in `find $directory/*.strings`; do
filename="$(basename "$file")"
# ignore the Localizable and LaunchScreen files
if [[ "$filename" == 'LaunchScreen.strings' ]]; then
rm $file
continue
fi
if [[ "$filename" == 'Localizable.strings' ]]; then
continue
fi
if [[ "$filename" == 'InfoPlist.strings' ]]; then
echo "Adding launch screen value to $language"
echo -e "\"UILaunchStoryboardName\" = \"LaunchScreen_$language\";" >> $file
continue
fi
2021-12-10 08:05:42 +00:00
echo "Concatenating $filename to Localizable.strings"
2020-08-03 06:01:39 +00:00
2021-12-10 08:05:42 +00:00
(echo ;cat "$file") >> "$directory/Localizable.strings"
2020-08-03 06:01:39 +00:00
echo "Deleting $file"
rm $file
done
echo "Done preparing files, starting copy"
for file in `find $directory/*.strings`; do
destinationFolder="../CovidSafe/$language.lproj"
cp $file $destinationFolder
echo "Copy files to project directory"
done
done
rm -r ../temp/locales