Skip to content

Instantly share code, notes, and snippets.

@getlocalization
Created May 28, 2013 07:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save getlocalization/5661023 to your computer and use it in GitHub Desktop.
Upload values folders and their respective strings.xml files to Get Localization. Prerequisites: - You have project already on Get Localization - Master file strings.xml already exists.
#!/bin/bash
# Path to your Android project res directory, it should contain the values directories.
RES_PATH=res/*
# Get Localization settings
USERNAME=u
PASSWORD=p
PROJECT=yourProject
for f in $RES_PATH
do
if [[ "$f" == *values-* ]]
then
iana=${f#*-}
# Check whether this iana code contains regional variant, remove the r
if [[ "$iana" == *-r* ]]
then
iana=${iana%%-r*}-${iana#*-r}
fi
echo "Uploading $f to project $iana"
curl --form file=@$f/strings.xml --user $USERNAME:$PASSWORD https://api.getlocalization.com/$PROJECT/api/translations/file/strings.xml/$iana/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment