Skip to content

Commit

Permalink
Switch translation tooling to GNU gettext. Commit helper script.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Jul 4, 2023
1 parent 3d73dac commit 98eebef
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
10 changes: 5 additions & 5 deletions calibre-plugin/translations/default.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Copyright (C) YEAR ping <http://github.com/ping>
# This file is distributed under the same license as the libby-calibre-plugin package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-04 07:25+0800\n"
"Project-Id-Version: libby-calibre-plugin 0.1.3\n"
"Report-Msgid-Bugs-To: https://github.com/ping/libby-calibre-plugin/\n"
"POT-Creation-Date: 2023-07-04 08:02+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
4 changes: 2 additions & 2 deletions calibre-plugin/translations/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-04 07:25+0800\n"
"Report-Msgid-Bugs-To: https://github.com/ping/libby-calibre-plugin/\n"
"POT-Creation-Date: 2023-07-04 07:41+0800\n"
"PO-Revision-Date: 2023-07-04 07:26+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
4 changes: 2 additions & 2 deletions calibre-plugin/translations/ko.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-04 07:25+0800\n"
"Report-Msgid-Bugs-To: https://github.com/ping/libby-calibre-plugin/\n"
"POT-Creation-Date: 2023-07-04 07:41+0800\n"
"PO-Revision-Date: 2023-07-04 07:26+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
4 changes: 2 additions & 2 deletions calibre-plugin/translations/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-04 07:25+0800\n"
"Report-Msgid-Bugs-To: https://github.com/ping/libby-calibre-plugin/\n"
"POT-Creation-Date: 2023-07-04 07:41+0800\n"
"PO-Revision-Date: 2023-07-04 07:26+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
4 changes: 2 additions & 2 deletions calibre-plugin/translations/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-04 07:25+0800\n"
"Report-Msgid-Bugs-To: https://github.com/ping/libby-calibre-plugin/\n"
"POT-Creation-Date: 2023-07-04 07:41+0800\n"
"PO-Revision-Date: 2023-07-04 07:25+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down
22 changes: 22 additions & 0 deletions translate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
if [[ -z "$1" ]]; then
version='0.1.3'
else
version="$1"
fi

# https://www.gnu.org/software/gettext/manual/gettext.html#xgettext-Invocation
xgettext -L Python \
--package-name='libby-calibre-plugin' \
--package-version="$version" \
--msgid-bugs-address='https://github.com/ping/libby-calibre-plugin/' \
--copyright-holder='ping <http://github.com/ping>' \
-o calibre-plugin/translations/default.pot calibre-plugin/*.py

# https://www.gnu.org/software/gettext/manual/gettext.html#msgmerge-Invocation
for f in calibre-plugin/translations/*.po
do
echo "Updating ${f} from default.pot"
msgmerge --update "${f}" "calibre-plugin/translations/default.pot"
echo "Building ${f%\.po} into ${f%\.po}.mo"
msgfmt -o "${f%\.po}.mo" "${f%\.po}"
done

0 comments on commit 98eebef

Please sign in to comment.