From 1a8ea8ba14308d0f29654d862606d28a5e9a370e Mon Sep 17 00:00:00 2001 From: Johannes Schwab Date: Thu, 8 Jan 2015 13:59:42 +0100 Subject: [PATCH] fix merge function of util/run_xgettext.sh --- util/README | 6 +++--- util/run_xgettext.sh | 21 ++++++++------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/util/README b/util/README index aceade3e23..20a539215e 100644 --- a/util/README +++ b/util/README @@ -82,11 +82,11 @@ Xgettext and .po workflow This script runs xgettext on source tree, extracting strings from t() and tt() functions, and creates a util/messages.po file. - % cd util; ./run_xgettext.sh ../view/{language}/messages.po - - Replace {language} with the language you are working on - e.g. 'es', 'fr', 'de', etc. + $ cd util; ./run_xgettext.sh 2. copy util/messages.po to view//messages.po + Replace with the language you are working on - e.g. 'es', 'fr', 'de', etc. + 3. open view//messages.po with a text editor and fill in infos in "Last-Translator: FULL NAME " "Language-Team: LANGUAGE \n" diff --git a/util/run_xgettext.sh b/util/run_xgettext.sh index 957cc2190b..0ceda68133 100755 --- a/util/run_xgettext.sh +++ b/util/run_xgettext.sh @@ -30,18 +30,6 @@ F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.p 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" echo "extract strings to $OUTFILE.." @@ -50,7 +38,7 @@ for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f) do if [ ! -d "$f" ] 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" fi done @@ -75,4 +63,11 @@ else sed -i "s/^\"Plural-Forms.*$//g" "$OUTFILE" fi +if [ "" != "$1" -a "$ADDONMODE" == "" ] +then + UPDATEFILE="$(readlink -f ${FULLPATH}/$1)" + echo "merging new strings to $UPDATEFILE.." + msgmerge -U $OUTFILE $UPDATEFILE +fi + echo "done."