cryptonas/scripts/fetch_po_files.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

2006-12-01 10:16:46 +01:00
#!/bin/sh
#
# this script symlinks all cbx po files to thorax' pootle dir
# it is useful to be root for this - otherwise chown and the pootle restart will fail
#
test $# -ne 1 && echo "Usage: $(basename $0) TARGET_DIR" && exit 1
test ! -d "$1" && echo "target directory does not exist: '$1'" && exit 1
TARGETPATH=$1
BASEPATH=$(cd $(dirname "$0")/..; pwd)
mkdir -p ${TARGETPATH}/templates
2006-12-01 10:16:46 +01:00
2006-12-01 20:26:30 +01:00
for language in `ls ${BASEPATH}/intl/` ; do
test ! -d "${BASEPATH}/intl/${language}" && continue
echo "Processing $language ..."
2006-12-01 20:26:30 +01:00
[ ! -d ${TARGETPATH}/${language} ] && mkdir -p ${TARGETPATH}/${language}
## base translation
find ${BASEPATH}/intl/${language} -name \*.po -exec ln -sfn '{}' ${TARGETPATH}/${language}/ \;
## plugin translations
for plugin in $(ls ${BASEPATH}/plugins/); do
test ! -d "${BASEPATH}/plugins/${plugin}" && continue
find ${BASEPATH}/plugins/${plugin}/intl/${language} -name \*.po -exec ln -sfn '{}' ${TARGETPATH}/${language}/ \;
2006-12-01 20:26:30 +01:00
done
2006-12-01 10:16:46 +01:00
done
2006-12-01 10:59:19 +01:00
echo "Processing template files ..."
find ${BASEPATH}/intl ${BASEPATH}/plugins -type f -name \*.pot | while read fname
do ln -sfn $fname ${TARGETPATH}/templates/
done
2006-12-01 10:16:46 +01:00
chown -R pootle. ${TARGETPATH}
2006-12-01 10:59:19 +01:00
/etc/init.d/pootle restart