fix merge function of util/run_xgettext.sh

This commit is contained in:
Johannes Schwab 2015-01-08 13:59:42 +01:00
parent d35b13fb58
commit 1a8ea8ba14
2 changed files with 11 additions and 16 deletions

View File

@ -82,11 +82,11 @@ Xgettext and .po workflow
This script runs xgettext on source tree, extracting strings from t() and tt() This script runs xgettext on source tree, extracting strings from t() and tt()
functions, and creates a util/messages.po file. functions, and creates a util/messages.po file.
% cd util; ./run_xgettext.sh ../view/{language}/messages.po $ cd util; ./run_xgettext.sh
Replace {language} with the language you are working on - e.g. 'es', 'fr', 'de', etc.
2. copy util/messages.po to view/<langauage>/messages.po 2. copy util/messages.po to view/<langauage>/messages.po
Replace <language> with the language you are working on - e.g. 'es', 'fr', 'de', etc.
3. open view/<langauage>/messages.po with a text editor and fill in infos in 3. open view/<langauage>/messages.po with a text editor and fill in infos in
"Last-Translator: FULL NAME <EMAIL@ADDRESS>" "Last-Translator: FULL NAME <EMAIL@ADDRESS>"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -30,18 +30,6 @@ F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.p
echo "Friendica version $F9KVERSION" echo "Friendica version $F9KVERSION"
OPTS=
#if [ "" != "$1" ]
#then
# OUTFILE="$(readlink -f ${FULLPATH}/$1)"
# if [ -e "$OUTFILE" ]
# then
# echo "join extracted strings"
# OPTS="-j"
# fi
#fi
KEYWORDS="-k -kt -ktt:1,2" KEYWORDS="-k -kt -ktt:1,2"
echo "extract strings to $OUTFILE.." echo "extract strings to $OUTFILE.."
@ -50,7 +38,7 @@ for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f)
do do
if [ ! -d "$f" ] if [ ! -d "$f" ]
then then
xgettext $KEYWORDS $OPTS -j -o "$OUTFILE" --from-code=UTF-8 "$f" xgettext $KEYWORDS -j -o "$OUTFILE" --from-code=UTF-8 "$f"
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE" sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
fi fi
done done
@ -75,4 +63,11 @@ else
sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE"
fi fi
if [ "" != "$1" -a "$ADDONMODE" == "" ]
then
UPDATEFILE="$(readlink -f ${FULLPATH}/$1)"
echo "merging new strings to $UPDATEFILE.."
msgmerge -U $OUTFILE $UPDATEFILE
fi
echo "done." echo "done."