2012-01-08 02:05:45 +01:00
|
|
|
#!/bin/sh
|
2023-04-29 01:23:16 +02:00
|
|
|
set -e
|
2012-01-08 02:05:45 +01:00
|
|
|
|
2012-04-04 04:47:05 +02:00
|
|
|
maybe_append() {
|
|
|
|
while read -r msg; do
|
2023-04-29 02:58:20 +02:00
|
|
|
msgfile=$(printf '%s' "$msg" | cut -d'|' -f1)
|
|
|
|
msgline=$(printf '%s' "$msg" | cut -d'|' -f2)
|
|
|
|
msgid=$(printf '%s' "$msg" | cut -d'|' -f3-)
|
2012-01-08 02:05:45 +01:00
|
|
|
|
2012-04-04 04:47:05 +02:00
|
|
|
if ! grep -Fq "msgid $msgid" aegisub.pot; then
|
2023-04-29 02:58:20 +02:00
|
|
|
printf "\n#: %s:%s\nmsgid %s\nmsgstr \"\"\n\n" \
|
|
|
|
"$msgfile" "$msgline" "$msgid" >> aegisub.pot
|
2012-04-04 04:47:05 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2012-03-13 00:35:47 +01:00
|
|
|
|
2023-04-29 02:58:20 +02:00
|
|
|
find ../src ../src/command -name '*.cpp' -o -name '*.h' \
|
2023-04-22 21:21:40 +02:00
|
|
|
| xgettext --files-from=- -o - --c++ --sort-by-file \
|
|
|
|
-k_ -kSTR_MENU -kSTR_DISP -kSTR_HELP -kfmt_tl -kfmt_plural:2,3 -kwxT -kwxPLURAL:1,2 \
|
2014-03-12 17:40:40 +01:00
|
|
|
| sed 's/SOME DESCRIPTIVE TITLE./Aegisub 3.2/' \
|
2014-01-01 16:19:25 +01:00
|
|
|
| sed 's/YEAR/2005-2014/' \
|
2012-04-04 04:47:05 +02:00
|
|
|
| sed "s/THE PACKAGE'S COPYRIGHT HOLDER/Rodrigo Braz Monteiro, Niels Martin Hansen, Thomas Goyne et. al./" \
|
|
|
|
| sed 's/PACKAGE/Aegisub/' \
|
2014-03-12 17:40:40 +01:00
|
|
|
| sed 's/VERSION/3.2.0/' \
|
2012-04-04 04:47:05 +02:00
|
|
|
| sed 's/FIRST AUTHOR <EMAIL@ADDRESS>/Niels Martin Hansen <nielsm@aegisub.org>/' \
|
|
|
|
| sed 's/CHARSET/UTF-8/' \
|
|
|
|
> aegisub.pot
|
2012-03-13 00:35:47 +01:00
|
|
|
|
2012-04-04 04:47:05 +02:00
|
|
|
sed '/"text"/!d;s/^.*"text" : \("[^"]\+"\).*$/default_menu.json|0|\1/' ../src/libresrc/default_menu.json \
|
|
|
|
| maybe_append
|
|
|
|
|
2012-05-23 05:38:34 +02:00
|
|
|
sed '/"text"/!d;s/^.*"text" : \("[^"]\+"\).*$/default_menu.json|0|\1/' ../src/libresrc/osx/default_menu.json \
|
|
|
|
| maybe_append
|
|
|
|
|
2012-04-10 22:40:48 +02:00
|
|
|
grep '"[A-Za-z ]\+" : {' -n ../src/libresrc/default_hotkey.json \
|
|
|
|
| sed 's/^\([0-9]\+:\).*\("[^"]\+"\).*$/default_hotkey.json|\1|\2/' \
|
|
|
|
| maybe_append
|
|
|
|
|
2023-04-29 02:58:20 +02:00
|
|
|
find ../automation -name '*.lua' \
|
2023-04-29 01:04:13 +02:00
|
|
|
| LC_ALL=C sort \
|
2023-04-29 02:58:20 +02:00
|
|
|
| xargs grep 'tr"[^"]*"' -o -n \
|
2012-04-04 04:47:05 +02:00
|
|
|
| sed 's/\(.*\):\([0-9]\+\):tr\(".*"\)/\1|\2|\3/' \
|
|
|
|
| maybe_append
|
|
|
|
|
2023-04-29 01:33:40 +02:00
|
|
|
xgettext ../packages/desktop/aegisub.desktop.in.in \
|
|
|
|
--language=Desktop --join-existing --omit-header -o aegisub.pot
|
2014-05-15 18:43:09 +02:00
|
|
|
|
2023-04-29 03:32:40 +02:00
|
|
|
xgettext ../packages/desktop/aegisub.appdata.xml.in.in \
|
|
|
|
--language=AppData --join-existing --omit-header -o aegisub.pot
|
2019-09-08 06:02:02 +02:00
|
|
|
|
2014-05-15 20:08:09 +02:00
|
|
|
grep '^_[A-Za-z0-9]*=.*' ../packages/win_installer/fragment_strings.iss.in | while read line
|
2014-05-15 18:43:09 +02:00
|
|
|
do
|
2023-04-29 02:58:20 +02:00
|
|
|
printf '%s\n' "$line" \
|
2014-05-15 18:43:09 +02:00
|
|
|
| sed 's/[^=]*=\(.*\)/packages\/win_installer\/fragment_strings.iss|1|"\1"/' \
|
|
|
|
| maybe_append
|
|
|
|
done
|
2023-04-30 18:09:48 +02:00
|
|
|
|
|
|
|
for lang in $(cat LINGUAS) ; do
|
|
|
|
# If using gettext < 0.21, run twice to avoid reversing order of old strings
|
|
|
|
# ref: https://savannah.gnu.org/bugs/?58778
|
|
|
|
msgmerge --update --backup=none --no-fuzzy-matching --sort-by-file "$lang".po aegisub.pot
|
|
|
|
done
|