aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--TRANSLATE45
-rw-r--r--po/POTFILES1
-rw-r--r--po/init-po.sh8
-rw-r--r--po/meson.build4
-rw-r--r--po/update-pot.sh16
5 files changed, 47 insertions, 27 deletions
diff --git a/TRANSLATE b/TRANSLATE
index 1a099d6..8a7d68b 100644
--- a/TRANSLATE
+++ b/TRANSLATE
@@ -3,12 +3,6 @@ weltschmerz uses the GNU gettext utilities [1] for translation.
We recommend reading this entire document as well as familiarizing yourself with
GNU gettext. See [2] for a quick overview.
-Note that the commands cited here require having set up a build environment with
-meson. If you have not yet done so, run 'meson build' to create one. The build
-environment now exists in the build/ directory. If you know your way around
-gettext however, you may skip this step and use its tooling instead of the meson
-wrappers discussed below.
-
INTRO
As a translator, it is your job to create (and maintain) your language's PO file
@@ -24,36 +18,41 @@ a patch. Refer to 'UPDATING THE POT FILE' for more information.
ADDING A TRANSLATION
-Record the language you intend to add in the LINGUAS file [3] and make sure that
-it is sorted alphabetically. Then, in the build directory, instruct meson to
-generate a PO file for your language:
+First, find your language's language code in [4] or [5]. Once you have found it,
+create a PO file by running the following in the project's root directory:
- meson compile weltschmerz-update-po
+ sh po/init-po.sh <Language code>
There should now be a PO file for your language in the po/ directory. You may
edit this file with whatever tool you are most comfortable with. If you don't
-know what to use, poedit [4] is a reasonable choice. Refer to [5] if you need
-information on how to translate plural forms.
-
-Once the translation is complete, commit your changes to the LINGUAS file as
-well as your language's PO file to git. You may then submit this commit to the
-author via git-format-patch(1) and git-send-email(1). If you don't know how to
-do this, see [6] for a guide. Feel free to find the author on IRC and ask for
-help if you are struggling.
+know what to use, poedit [6] is a reasonable choice. Refer to [7] if you need
+information on how to translate plural forms. Make sure to fill out the header
+properly (this is best done in a text editor). You may refer to already existing
+PO files for this. Finally, make sure to add your language's PO file to POFILES
+in the Makefile.
+
+Once the translation is complete, commit the changes to the LINGUAS file, the
+Makefile, and your language's PO file to git. You may then submit this commit
+to the author via git-format-patch(1) and git-send-email(1). If you don't know
+how to do this, see [8] for a guide. Feel free to find the author on IRC and
+ask for help if you are struggling.
UPDATING THE POT FILE
Even though the POT file should always be up to date, sometimes you may need to
regenerate it to pick up on changes to the source code that went unnoticed by
-the author. To do this, run the following command in the build directory:
+the author. To do this, run the following in the project's root directory:
- meson compile weltschmerz-pot
+ sh po/update-pot.sh
+Note that this will also update all translations listed in the LINGUAS file.
Please commit and submit this change separately from any translation.
[1] https://www.gnu.org/software/gettext
[2] https://www.gnu.org/software/gettext/manual/gettext.html#Overview
[3] https://www.gnu.org/software/gettext/manual/gettext.html#po_002fLINGUAS
-[4] https://poedit.net/
-[5] https://www.gnu.org/software/gettext/manual/gettext.html#Translating-plural-forms
-[6] https://git-scm.com/docs/MyFirstContribution#howto-git-send-email
+[4] https://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html
+[5] https://www.gnu.org/software/gettext/manual/html_node/Rare-Language-Codes.html
+[6] https://poedit.net/
+[7] https://www.gnu.org/software/gettext/manual/gettext.html#Translating-plural-forms
+[8] https://git-scm.com/docs/MyFirstContribution#howto-git-send-email
diff --git a/po/POTFILES b/po/POTFILES
index 107469c..4d9f89d 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1,4 +1,3 @@
configreader.vala
terminal.ui
terminal.vala
-weltschmerz.desktop.in
diff --git a/po/init-po.sh b/po/init-po.sh
new file mode 100644
index 0000000..0830875
--- /dev/null
+++ b/po/init-po.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+lang=$1
+
+echo "$lang" >> po/LINGUAS
+sort -u po/LINGUAS -o po/LINGUAS
+
+msginit -i po/weltschmerz.pot -o "po/${lang}.po" --locale "$lang" --no-translator
diff --git a/po/meson.build b/po/meson.build
index 5cbb15b..6870f58 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -4,6 +4,4 @@ localedir = join_paths(get_option('prefix'), get_option('localedir'))
add_project_arguments('-DGETTEXT_PACKAGE="weltschmerz"', language: 'c')
add_project_arguments('-DLOCALEDIR="@0@"'.format(localedir), language: 'c')
-i18n.gettext(meson.project_name(),
- args: ['--directory=' + meson.source_root(), '-c TRANSLATORS', '--from-code=UTF-8']
-)
+i18n.gettext(meson.project_name(), args: '--directory=' + meson.source_root())
diff --git a/po/update-pot.sh b/po/update-pot.sh
new file mode 100644
index 0000000..6ceb21f
--- /dev/null
+++ b/po/update-pot.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+_xgettext() {
+ xgettext --package-name=weltschmerz -cTRANSLATORS "$@" -o po/weltschmerz.pot
+}
+
+_xgettext -f po/POTFILES
+
+# We treat this file specially in order to override the keywords used for it.
+# Since we do not want Name translated, reset the keyword list with -k and then
+# add the keywords we want.
+_xgettext -j -k -kComment -kKeywords weltschmerz.desktop.in
+
+while read lang; do
+ msgmerge -q -o "po/${lang}.po" "po/${lang}.po" po/weltschmerz.pot
+done < po/LINGUAS