2 FULLPATH=$(dirname $(readlink -f "$0"))
6 if [ "$1" == "--addon" -o "$1" == "-a" ]
9 if [ -z $2 ]; then echo -e "ERROR: missing addon name\n\nrun_xgettext.sh -a <addonname>"; exit 1; fi
11 if [ ! -d "$FULLPATH/../addon/$ADDONNAME" ]; then echo "ERROR: addon '$ADDONNAME' not found"; exit 2; fi
16 cd "$FULLPATH/../addon/$ADDONNAME"
17 mkdir -p "$FULLPATH/../addon/$ADDONNAME/lang/C"
18 OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/messages.po"
22 cd "$FULLPATH/../view/en/"
23 OUTFILE="$FULLPATH/messages.po"
26 FINDOPTS="-wholename */addon -prune -o"
29 F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ../../boot.php);
31 echo "Friendica version $F9KVERSION"
37 # OUTFILE="$(readlink -f ${FULLPATH}/$1)"
38 # if [ -e "$OUTFILE" ]
40 # echo "join extracted strings"
45 KEYWORDS="-k -kt -ktt:1,2"
47 echo "extract strings to $OUTFILE.."
48 rm "$OUTFILE"; touch "$OUTFILE"
49 for f in $(find "$FINDSTARTDIR" $FINDOPTS -name "*.php" -type f)
53 xgettext $KEYWORDS $OPTS -j -o "$OUTFILE" --from-code=UTF-8 "$f"
57 echo "setup base info.."
60 sed -i "s/SOME DESCRIPTIVE TITLE./ADDON $ADDONNAME/g" "$OUTFILE"
61 sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER//g" "$OUTFILE"
62 sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.//g" "$OUTFILE"
63 sed -i "s/PACKAGE VERSION//g" "$OUTFILE"
64 sed -i "s/PACKAGE/Friendica $ADDONNAME addon/g" "$OUTFILE"
65 sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
66 sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE"
68 sed -i "s/SOME DESCRIPTIVE TITLE./FRIENDICA Distributed Social Network/g" "$OUTFILE"
69 sed -i "s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2010, 2011, 2012, 2013 the Friendica Project/g" "$OUTFILE"
70 sed -i "s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Mike Macgirvin, 2010/g" "$OUTFILE"
71 sed -i "s/PACKAGE VERSION/$F9KVERSION/g" "$OUTFILE"
72 sed -i "s/PACKAGE/Friendica/g" "$OUTFILE"
73 sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
74 sed -i "s/^\"Plural-Forms/#\"Plural-Forms/g" "$OUTFILE"