Skip to content

Instantly share code, notes, and snippets.

@vitovalov
Created February 20, 2015 22:07
Show Gist options
  • Save vitovalov/9b8ba23166b5862ed60b to your computer and use it in GitHub Desktop.
Save vitovalov/9b8ba23166b5862ed60b to your computer and use it in GitHub Desktop.
This script allows to generate android strings.xml in each defined language creating all needed directories
# Made by vitovalov@gmail.com
# Overwrites existing files and directories
# Creates missing directories
node generate strings.json 'android'
# no trailing slash
PROJECT_DIR=~/project/src/main/res
if [ ! -d "$PROJECT_DIR" ]; then
echo "Error: Please define PROJECT_DIR"
exit 1
# destination trailing slash indicates that input should go inside of $PROJECT_DIR
# copies the directory values-es overwriting the existant
# copies the files inside of values-es to dest directory
cp -vR android/values-es $PROJECT_DIR/
# -p to create intermidiate dirs if not exist and to not warn when dir already exists
mkdir -p $PROJECT_DIR/values
# copies the contents of the source dir inside the dest directory
cp -vR android/values-en/* $PROJECT_DIR/values
cp -vR android/values-ru $PROJECT_DIR/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment