make-template.sh: fix, improve, update, run

This commit is contained in:
Přemysl Eric Janouch 2021-10-11 21:13:53 +02:00
parent e2790b42f3
commit b8e43c5d5a
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 69 additions and 75 deletions

View File

@ -1,47 +1,19 @@
#!/bin/sh #!/bin/sh -e
# This shell script generates the translation template. # This shell script generates the translation template.
# #
# The reason for this not being inside CMakeLists.txt # The reason for this not being inside CMakeLists.txt is that the translator
# is that the translator should not need to run the whole # should not need to run the whole configuration process just to get this file.
# configuration process just to get this single stupid file. dir=$(dirname $0)
# Get the directory this script resides in so that the user re='^[ \t]*project *( *\([^ \t)]\{1,\}\) \{1,\}VERSION \{1,\}\([^ \t)]\{1,\}\).*'
# doesn't have to run the script from there package=$(sed -n "s/$re/\\1/p" "$dir/../CMakeLists.txt")
DIR=$(dirname $0) version=$(sed -n "s/$re/\\2/p" "$dir/../CMakeLists.txt")
if [ -z "$package" -o -z "$version" ]; then
# Collect source files
SOURCES=$(echo $DIR/../src/*.c)
# Get the package name from CMakeLists.txt
PACKAGE=$(sed -n '/^[ \t]*project[ \t]*([ \t]*\([^ \t)]\{1,\}\).*).*/{s//\1/p;q}' \
$DIR/../CMakeLists.txt)
# Get the package version from CMakeLists.txt
EXP_BEG='/^[ \t]*set[ \t]*([ \t]*project_VERSION_'
EXP_END='[ \t]\{1,\}"\{0,1\}\([^)"]\{1,\}\)"\{0,1\}).*/{s//\1/p;q}'
MAJOR=$(sed -n "${EXP_BEG}MAJOR${EXP_END}" $DIR/../CMakeLists.txt)
MINOR=$(sed -n "${EXP_BEG}MINOR${EXP_END}" $DIR/../CMakeLists.txt)
PATCH=$(sed -n "${EXP_BEG}PATCH${EXP_END}" $DIR/../CMakeLists.txt)
if [ "$MAJOR" != "" ]; then
VERSION=$MAJOR
if [ "$MINOR" != "" ]; then
VERSION=$VERSION.$MINOR
if [ "$PATCH" != "" ]; then
VERSION=$VERSION.$PATCH
fi
fi
fi
if [ -z "$PACKAGE" -o -z "$VERSION" ]; then
echo "Failed to get information from CMakeLists.txt" echo "Failed to get information from CMakeLists.txt"
exit 1 exit 1
fi fi
# Finally make the template xgettext -LC -k_ -kN_ $dir/../src/*.c -o "$dir/$package.pot" \
xgettext -LC -k_ -kN_ $SOURCES -o "$DIR/$PACKAGE.pot" \ --package-name="$package" --package-version="$version" \
--package-name="$PACKAGE" --package-version="$VERSION" \
--copyright-holder="Přemysl Eric Janouch" \ --copyright-holder="Přemysl Eric Janouch" \
--msgid-bugs-address="https://github.com/pjanouch/$PACKAGE/issues" --msgid-bugs-address="https://git.janouch.name/p/$package/issues"

View File

@ -7,8 +7,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdtui 0.1.0\n" "Project-Id-Version: sdtui 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/pjanouch/sdtui/issues\n" "Report-Msgid-Bugs-To: https://git.janouch.name/p/sdtui/issues\n"
"POT-Creation-Date: 2016-09-28 16:12+0200\n" "POT-Creation-Date: 2021-10-11 21:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,115 +17,137 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/sdtui.c:283 #: ../src/sdgtk.c:289 ../src/sdtui.c:2481
msgid "Warning"
msgstr ""
#: ../src/sdgtk.c:289 ../src/sdtui.c:2481
msgid "failed to set the locale"
msgstr ""
#: ../src/sdgtk.c:299
msgid "FILE..."
msgstr ""
#: ../src/sdgtk.c:304
msgid "- StarDict GTK+ UI"
msgstr ""
#: ../src/sdgtk.c:355
msgid "Follow selection"
msgstr ""
#: ../src/sdtui.c:320
msgid "error in entry" msgid "error in entry"
msgstr "" msgstr ""
#: ../src/sdtui.c:302 #: ../src/sdtui.c:415
msgid "no usable field found" msgid "no usable field found"
msgstr "" msgstr ""
#: ../src/sdtui.c:548 #: ../src/sdtui.c:700
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: ../src/sdtui.c:573 #: ../src/sdtui.c:726
msgid "Cannot load configuration" msgid "Cannot load configuration"
msgstr "" msgstr ""
#: ../src/sdtui.c:606 #: ../src/sdtui.c:745
msgid "Error loading dictionary" msgid "Error loading dictionary"
msgstr "" msgstr ""
#: ../src/sdtui.c:612 #: ../src/sdtui.c:750
msgid "" msgid ""
"No dictionaries found either in the configuration or on the command line" "No dictionaries found either in the configuration or on the command line"
msgstr "" msgstr ""
#: ../src/sdtui.c:966 #: ../src/sdtui.c:1114
msgid "Terminal UI for StarDict dictionaries" msgid "Terminal UI for StarDict dictionaries"
msgstr "" msgstr ""
#: ../src/sdtui.c:969 #: ../src/sdtui.c:1117
msgid "Type to search" msgid "Type to search"
msgstr "" msgstr ""
#: ../src/sdtui.c:1976 #: ../src/sdtui.c:2095
#, c-format
msgid "X11 connection failed (error code %d)"
msgstr ""
#: ../src/sdtui.c:2241
#, c-format
msgid "X11 request error (%d, major %d, minor %d)"
msgstr ""
#: ../src/sdtui.c:2476
msgid "Output version information and exit" msgid "Output version information and exit"
msgstr "" msgstr ""
#: ../src/sdtui.c:1981 #: ../src/sdtui.c:2489
msgid "Warning"
msgstr ""
#: ../src/sdtui.c:1981
msgid "failed to set the locale"
msgstr ""
#: ../src/sdtui.c:1989
msgid "[dictionary.ifo...] - StarDict terminal UI" msgid "[dictionary.ifo...] - StarDict terminal UI"
msgstr "" msgstr ""
#: ../src/sdtui.c:1997 #: ../src/sdtui.c:2497
msgid "Error" msgid "Error"
msgstr "" msgstr ""
#: ../src/sdtui.c:1997 #: ../src/sdtui.c:2497
msgid "option parsing failed" msgid "option parsing failed"
msgstr "" msgstr ""
#: ../src/stardict.c:91 #: ../src/stardict.c:89
msgid "invalid header format" msgid "invalid header format"
msgstr "" msgstr ""
#: ../src/stardict.c:227 #: ../src/stardict.c:249
msgid "version not specified" msgid "version not specified"
msgstr "" msgstr ""
#: ../src/stardict.c:238 #: ../src/stardict.c:260
msgid "invalid version" msgid "invalid version"
msgstr "" msgstr ""
#: ../src/stardict.c:252 #: ../src/stardict.c:274
msgid "unknown key, ignoring" msgid "unknown key, ignoring"
msgstr "" msgstr ""
#: ../src/stardict.c:259 #: ../src/stardict.c:281
msgid "invalid encoding, must be valid UTF-8" msgid "invalid encoding, must be valid UTF-8"
msgstr "" msgstr ""
#: ../src/stardict.c:276 #: ../src/stardict.c:298
msgid "invalid integer" msgid "invalid integer"
msgstr "" msgstr ""
#: ../src/stardict.c:286 #: ../src/stardict.c:308
msgid "option format error" msgid "option format error"
msgstr "" msgstr ""
#: ../src/stardict.c:296 #: ../src/stardict.c:318
msgid "no book name specified" msgid "no book name specified"
msgstr "" msgstr ""
#: ../src/stardict.c:302 #: ../src/stardict.c:324
msgid "word count not specified" msgid "word count not specified"
msgstr "" msgstr ""
#: ../src/stardict.c:308 #: ../src/stardict.c:330
msgid "index file size not specified" msgid "index file size not specified"
msgstr "" msgstr ""
#: ../src/stardict.c:317 #: ../src/stardict.c:339
msgid "invalid index offset bits" msgid "invalid index offset bits"
msgstr "" msgstr ""
#: ../src/stardict.c:812 #: ../src/stardict.c:827
msgid "cannot find .idx file" msgid "cannot find .idx file"
msgstr "" msgstr ""
#: ../src/stardict.c:835 #: ../src/stardict.c:850
msgid "cannot find .dict file" msgid "cannot find .dict file"
msgstr "" msgstr ""
#: ../src/stardict.c:1130 ../src/stardict.c:1155 #: ../src/stardict.c:1153 ../src/stardict.c:1178
msgid "invalid data entry" msgid "invalid data entry"
msgstr "" msgstr ""