Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOCALE="en"
- FORMAT="yml"
- BACKUP="--no-backup "
- # Get the options if they were set
- while getopts ":tbl:f:n:" opt; do
- case $opt in
- t)
- if [ -d "src/" ]
- then
- echo "Updating twig files to have translations in all variables"
- `find src/ -type f -name "*.html.twig" | xargs perl -pi -e "s/>([^\s<{>].*?)</>{{ '\1'|trans }}</g"`
- fi
- ;;
- b)
- BACKUP=""
- ;;
- l)
- LOCALE=$OPTARG
- ;;
- f)
- FORMAT=$OPTARG
- ;;
- n)
- if [ -d "src/$OPTARG/Bundle" ]
- then
- DIRECTORIES=src/$OPTARG/Bundle/*
- for d in $DIRECTORIES
- do
- module=`basename $d`
- echo "Processing $OPTARG$module"
- CMD="app/console translation:update --force --output-format=$FORMAT --clean $BACKUP $LOCALE $OPTARG$module"
- eval $CMD
- done
- fi
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument." >&2
- exit 1
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement