You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/bin/getloc-import

48 lines
1.2 KiB
Bash

#!/bin/bash
STRS=translations/strings.xml
STRS_API=translations/strings-api.xml
if [ $# -ne 1 ]
then
echo "Requires language tag or 'all' argument"
exit
fi
rm -f $STRS
rm -f $STRS_API
read -p "Enter GetLocalization username: " user
read -s -p "Enter GetLocalization password: " pw
LANG=$1
if [ "$LANG" == "all" ]
then
curl --user $user:$pw https://api.getlocalization.com/astrid/api/translations/zip/ -o translations/all.zip ; echo
mkdir translations/all
tar xzf translations/all.zip -C translations/all
for F in translations/all/*
do
LANG=`basename $F`
STRS=$F/strings.xml
STRS_API=$F/strings-api.xml
sed -i '' "s/'/\\\\'/g" $STRS
sed -i '' "s/'/\\\\'/g" $STRS_API
mv $STRS astrid/res/values-$LANG/strings.xml
mv $STRS_API api/res/values-$LANG/strings.xml
done
rm -rf translations/all
rm translations/all.zip
else
curl --user $user:$pw https://api.getlocalization.com/astrid/api/translations/file/strings.xml/$LANG/ -o $STRS ; echo
curl --user $user:$pw https://api.getlocalization.com/astrid/api/translations/file/strings-api.xml/$LANG/ -o $STRS_API ; echo
mv $STRS astrid/res/values-$LANG/strings.xml
mv $STRS_API api/res/values-$LANG/strings.xml
fi