Skip to content

Instantly share code, notes, and snippets.

@bonnyfone
Last active January 8, 2018 10:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonnyfone/32d18d1f4cb1d6292943d545d63af32c to your computer and use it in GitHub Desktop.
Save bonnyfone/32d18d1f4cb1d6292943d545d63af32c to your computer and use it in GitHub Desktop.
Simple bash script which automatically generates locales resConfigs snippet from your project's res/ directory
#!/bin/bash
GREEN='\033[0;32m'
NC='\033[0m'
printf "Generating resConfig from resource dir: $1\n"
resconfig="resConfigs"
for values in `ls $1 | grep values-`; do
log="Inspecting $values"
if [ -f "$1/$values/strings.xml" ]
then
suffix=`echo $values | sed 's/values-//g'`
log="$log ${GREEN}(FOUND)${NC}"
resconfig="$resconfig \"$suffix\","
fi
echo -e $log
done
resconfig="${resconfig::-1}"
printf "\nAdd the following resConfigs in your build.gradle:\n\n\t ${GREEN}$resconfig${NC}\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment