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

53 lines
1.3 KiB
Bash

#!/bin/bash
STRS=translations/strings.xml
STRS_API=translations/strings-api.xml
if [ $# -ne 1 ]
then
echo "Requires langauge tag or 'master' argument"
exit
fi
rm -f $STRS
rm -f $STRS_API
read -p "Enter GetLocalization username: " user
read -s -p "Enter GetLocalization password: " pw
echo
LANG=$1
if [ "$LANG" == "master" ]
then
# concatenate astrid XML files
catxml="`dirname $0`/catxml"
${catxml} astrid/res/values/strings*.xml > $STRS
# copy api file
cp api/res/values/strings.xml $STRS_API
else
cp astrid/res/values-$LANG/strings.xml $STRS
cp api/res/values-$LANG/strings.xml $STRS_API
fi
# replace \' with '
sed -i '' "s/\\\\'/'/g" $STRS
sed -i '' "s/\\\\'/'/g" $STRS_API
# upload files as master android filesi
if [ "$LANG" == "master" ]
then
curl --form file=@$STRS --user $user:$pw https://api.getlocalization.com/astrid/api/update-master/ ; echo
curl --form file=@$STRS_API --user $user:$pw https://api.getlocalization.com/astrid/api/update-master/ ; echo
else
LANG_MOD=`echo $LANG | sed 's/-r/-/'`
curl --form file=@$STRS --user $user:$pw https://api.getlocalization.com/astrid/api/translations/file/strings.xml/$LANG_MOD/ ; echo
curl --form file=@$STRS_API --user $user:$pw https://api.getlocalization.com/astrid/api/translations/file/strings-api.xml/$LANG_MOD/ ; echo
fi
rm -f $STRS
rm -f $STRS_API