Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.