mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-29 08:14:08 +00:00
[i18n] Fix pot generation to avoid a lot of manual work.
This commit is contained in:
parent
c73f00eb19
commit
83d53b204e
@ -19,46 +19,29 @@ msgstr ""
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat ../../tomb | awk '
|
# This is how we get the strings to be translated:
|
||||||
/_verbose ".*"/ {
|
#
|
||||||
split($0, arr, "\"");
|
# 1. sed filters the tomb file and only shows the lines containing a print
|
||||||
print "#: _verbose";
|
# function, e.g. warning. It outputs two columns separated by a tab.
|
||||||
print "msgid \"" arr[2] "\"";
|
# The first column contains the function that is called, and the second one
|
||||||
print "msgstr \"\"\n" }
|
# contains the message.
|
||||||
|
#
|
||||||
|
# 2. cat adds the line number as a new first column.
|
||||||
|
#
|
||||||
|
# 3. sort orders the lines using the third column and removes contiguous
|
||||||
|
# duplicate lines. The third column is the string to be translated, removing
|
||||||
|
# duplicates even if they are printed by different functions.
|
||||||
|
#
|
||||||
|
# 4. sort reorders the lines numerically using the first column.
|
||||||
|
#
|
||||||
|
# 5. awk reads the column-formatted input and outputs valid pot lines.
|
||||||
|
|
||||||
/_success ".*"/ {
|
PRINTFUNC="_\(verbose\|sucess\|warning\|failure\|message\|print\)"
|
||||||
split($0, arr, "\"");
|
|
||||||
print "#: _success";
|
|
||||||
print "msgid \"" arr[2] "\"";
|
|
||||||
print "msgstr \"\"\n" }
|
|
||||||
|
|
||||||
/_warning ".*"/ {
|
sed -n -e "s/^.*$PRINTFUNC \(\".*\"\).*$/\1\t\2/p" ../../tomb \
|
||||||
split($0, arr, "\"");
|
| cat -n | sort -uk3 | sort -nk1 | cut -f2- | awk \
|
||||||
print "#: _warning";
|
'BEGIN { FS = "\t" }
|
||||||
print "msgid \"" arr[2] "\"";
|
{ print "#:", $1;
|
||||||
print "msgstr \"\"\n" }
|
print "msgid", $2;
|
||||||
|
print "msgstr \"\"\n"
|
||||||
/_failure ".*"/ {
|
}'
|
||||||
split($0, arr, "\"");
|
|
||||||
print "#: _failure";
|
|
||||||
print "msgid \"" arr[2] "\"";
|
|
||||||
print "msgstr \"\"\n" }
|
|
||||||
|
|
||||||
/_message ".*"/ {
|
|
||||||
split($0, arr, "\"");
|
|
||||||
print "#: _message";
|
|
||||||
print "msgid \"" arr[2] "\"";
|
|
||||||
print "msgstr \"\"\n" }
|
|
||||||
|
|
||||||
/_message -n ".*"/ {
|
|
||||||
split($0, arr, "\"");
|
|
||||||
print "#: _message -n";
|
|
||||||
print "msgid \"" arr[2] "\"";
|
|
||||||
print "msgstr \"\"\n" }
|
|
||||||
|
|
||||||
/_print ".*"/ {
|
|
||||||
split($0, arr, "\"");
|
|
||||||
print "#: _print";
|
|
||||||
print "msgid \"" arr[2] "\"";
|
|
||||||
print "msgstr \"\"\n" }
|
|
||||||
'
|
|
||||||
|
Loading…
Reference in New Issue
Block a user