Fix pot generation
Filter out duplicate strings, and escape backslashes from lua strings. Include strings from aegisub.desktop. Originally committed to SVN as r6655.
This commit is contained in:
parent
566f08f308
commit
e557aa866b
1 changed files with 35 additions and 12 deletions
|
@ -1,17 +1,40 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
find ../src ../src/command -name \*.cpp -o -name \*.h | \
|
maybe_append() {
|
||||||
xgettext --files-from=- -o - --c++ -k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kwxT | \
|
while read -r msg; do
|
||||||
sed 's/SOME DESCRIPTIVE TITLE/Aegisub 3.0.0/' | \
|
msgfile=$(echo $msg | cut -d'|' -f1)
|
||||||
sed 's/YEAR/2005-2012/' | \
|
msgline=$(echo $msg | cut -d'|' -f2)
|
||||||
sed "s/THE PACKAGE'S COPYRIGHT HOLDER/Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et. al./" | \
|
msgid=$(echo $msg | cut -d'|' -f3-)
|
||||||
sed 's/PACKAGE/Aegisub 3.0.0/' > \
|
|
||||||
aegisub.pot
|
|
||||||
|
|
||||||
sed '/"text"/!d;s/^.*"text" : \("[^"]\+"\).*$/\n#: default_menu.json\nmsgid \1\nmsgstr ""\n/' ../src/libresrc/default_menu.json >> aegisub.pot
|
if ! grep -Fq "msgid $msgid" aegisub.pot; then
|
||||||
|
echo "\n#: $msgfile:$msgline\nmsgid $msgid\nmsgstr \"\"\n" >> aegisub.pot
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
find ../automation -name *.lua | \
|
find ../src ../src/command -name \*.cpp -o -name \*.h \
|
||||||
xargs grep tr\"[^\"]\*\" -o -n | \
|
| xgettext --files-from=- -o - --c++ -k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kwxT \
|
||||||
sed 's/\(.*\):\([0-9]\+\):tr\(".*"\)/#: \1:\2\nmsgid \3\nmsgstr ""\n/' \
|
| sed 's/SOME DESCRIPTIVE TITLE./Aegisub 3.0.0/' \
|
||||||
>> aegisub.pot
|
| sed 's/YEAR/2005-2012/' \
|
||||||
|
| sed "s/THE PACKAGE'S COPYRIGHT HOLDER/Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et. al./" \
|
||||||
|
| sed 's/PACKAGE/Aegisub/' \
|
||||||
|
| sed 's/VERSION/3.0.0/' \
|
||||||
|
| sed 's/FIRST AUTHOR <EMAIL@ADDRESS>/Niels Martin Hansen <nielsm@aegisub.org>/' \
|
||||||
|
| sed 's/CHARSET/UTF-8/' \
|
||||||
|
> aegisub.pot
|
||||||
|
|
||||||
|
sed '/"text"/!d;s/^.*"text" : \("[^"]\+"\).*$/default_menu.json|0|\1/' ../src/libresrc/default_menu.json \
|
||||||
|
| maybe_append
|
||||||
|
|
||||||
|
find ../automation -name *.lua \
|
||||||
|
| xargs grep tr\"[^\"]\*\" -o -n \
|
||||||
|
| sed 's/\(.*\):\([0-9]\+\):tr\(".*"\)/\1|\2|\3/' \
|
||||||
|
| sed 's/\\/\\\\\\\\/g' \
|
||||||
|
| maybe_append
|
||||||
|
|
||||||
|
for i in 'Name' 'GenericName' 'Comment'
|
||||||
|
do
|
||||||
|
grep ^$i -n ../desktop/aegisub.desktop.in \
|
||||||
|
| sed 's/\([0-9]\+\):[^=]\+=\(.*\)$/aegisub.desktop|\1|"\2"/' \
|
||||||
|
| maybe_append
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue