groups/scripts/pot-extract.sh
Christian Berendt bd3f4b83f5 Use '#!/usr/bin/env bash' as shebang in script files
Change-Id: I189d7c13425746db915415577a9e4a090aebf285
2015-08-29 20:34:00 +02:00

29 lines
873 B
Bash
Executable File

#!/usr/bin/env bash
# Extract translation template files from groups modules
#
# templates will be created in translations/ directory as
# <module-name>-<version>.pot
#
# Usage:
# cd profiles/groups
# ./scripts/pot-extract.sh
PROFILE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )
mkdir -p $PROFILE_DIR/translations/templates
MODULE_DIR=${PROFILE_DIR}/modules/groups/
echo $PROFILE_DIR
ls -1 $MODULE_DIR | while read f; do
cd $MODULE_DIR/$f
drush potx single
# transform absolute path to relative and write output to .pot file
# remove new lines from EOF and EOL whitespaces
POT_FILE=$PROFILE_DIR/translations/templates/$f-7.x-1.0.pot
cat $PROFILE_DIR/../../general.pot | \
sed -e "s=$MODULE_DIR==" | \
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \
sed 's/[ \t]*$//' > $POT_FILE
done
# clean-up general.pot
rm $PROFILE_DIR/../../general.pot