[hitori/wip/pwithnall/gettext] WIP work to port to gettext
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hitori/wip/pwithnall/gettext] WIP work to port to gettext
- Date: Thu, 11 Jun 2015 18:19:39 +0000 (UTC)
commit af8bbbca40184560edd5c0f803374c6c5ae346c4
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Jun 11 19:18:51 2015 +0100
WIP work to port to gettext
stalled on gettext supporting AppData fully
https://savannah.gnu.org/bugs/index.php?45305
Makefile.am | 18 ++---------
autogen.sh | 1 -
configure.ac | 6 +--
data/hitori.appdata.xml.in | 16 +++++-----
data/hitori.desktop.in | 6 ++--
po/Makevars | 68 ++++++++++++++++++++++++++++++++++++++++++++
po/POTFILES.in | 5 +--
src/interface.c | 2 +-
src/main.c | 10 +++---
9 files changed, 92 insertions(+), 40 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5dbbff6..5951c2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,9 +96,10 @@ gsettings_SCHEMAS = data/org.gnome.hitori.gschema.xml
@GSETTINGS_RULES@
# Desktop file
-# We can't use INTLTOOL_DESKTOP_RULE here due to lp#605826
%.desktop: %.desktop.in
- $(MKDIR_P) $(dir $@); LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache
$(top_srcdir)/po $< $@
+ @$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN) $(MSGFMT) --desktop --template $< -o $ -t \
+ -d $(top_srcdir)/po && mv $ -t $@
desktop_in_files = data/hitori.desktop.in
desktopdir = $(datadir)/applications
@@ -112,7 +113,6 @@ CLEANFILES += $(desktop_DATA)
# AppData
@APPSTREAM_XML_RULES@
- INTLTOOL_XML_RULE@
appstream_in_files = data/hitori.appdata.xml.in
appstream_XML = $(appstream_in_files:.appdata.xml.in=.appdata.xml)
@@ -123,9 +123,6 @@ CLEANFILES += $(appstream_XML)
# Gubbins
EXTRA_DIST += \
autogen.sh \
- intltool-extract.in \
- intltool-merge.in \
- intltool-update.in \
README \
COPYING \
COPYING-DOCS \
@@ -138,12 +135,6 @@ EXTRA_DIST += \
hitori.doap \
$(NULL)
-DISTCLEANFILES = \
- intltool-extract \
- intltool-merge \
- intltool-update \
- $(NULL)
-
MAINTAINERCLEANFILES = \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
@@ -152,9 +143,6 @@ MAINTAINERCLEANFILES = \
compile \
config.h.in \
config.rpath \
- intltool-extract.in \
- intltool-merge.in \
- intltool-update.in \
`find "m4" -type f -name "*.m4" -print` \
ChangeLog \
po/Makevars.template \
diff --git a/autogen.sh b/autogen.sh
index 78f954b..be3d608 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -20,7 +20,6 @@ fi
set -x
aclocal --install || exit 1
-intltoolize --force --copy --automake || exit 1
autoreconf --verbose --force --install -Wno-portability || exit 1
if [ "$NOCONFIGURE" = "" ]; then
diff --git a/configure.ac b/configure.ac
index a17d13f..1d69171 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,10 +25,8 @@ AX_CODE_COVERAGE()
AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources])
# Internationalisation
-GETTEXT_PACKAGE=hitori
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext package name])
-IT_PROG_INTLTOOL([0.50.2])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.19])
# GSettings
GLIB_GSETTINGS
diff --git a/data/hitori.appdata.xml.in b/data/hitori.appdata.xml.in
index c370837..33ed79e 100644
--- a/data/hitori.appdata.xml.in
+++ b/data/hitori.appdata.xml.in
@@ -5,17 +5,17 @@
<metadata_license>CC-BY-SA-3.0</metadata_license>
<project_license>GPL-3.0+ and CC-BY-SA-3.0</project_license>
<!-- Translators: the name of the application as it appears in a software center -->
- <_name>GNOME Hitori</_name>
+ <name>GNOME Hitori</name>
<!-- Translators: the brief summary of the application as it appears in a software center. -->
- <_summary>Play the Hitori puzzle game</_summary>
+ <summary>Play the Hitori puzzle game</summary>
<description>
<!-- Translators: These are the application description paragraphs in the AppData file. -->
- <_p>Hitori is a logic game similar to the popular game of Sudoku.</_p>
- <_p>You play the game against the clock, aiming to eliminate all
- the duplicate numbers in each row and column in the fastest
- time. Multiple sizes of game board are supported, and you
- can place markers on cells to help work out the solution.
- If you get stuck, the game can give you a hint.</_p>
+ <p>Hitori is a logic game similar to the popular game of Sudoku.</p>
+ <p>You play the game against the clock, aiming to eliminate all
+ the duplicate numbers in each row and column in the fastest
+ time. Multiple sizes of game board are supported, and you
+ can place markers on cells to help work out the solution.
+ If you get stuck, the game can give you a hint.</p>
</description>
<screenshots>
<screenshot type="default" width="400"
height="480">https://people.gnome.org/~mcatanzaro/hitori.png</screenshot>
diff --git a/data/hitori.desktop.in b/data/hitori.desktop.in
index f732796..7d1ef50 100644
--- a/data/hitori.desktop.in
+++ b/data/hitori.desktop.in
@@ -1,8 +1,8 @@
[Desktop Entry]
-_Name=Hitori
-_Comment=Play the Hitori puzzle game
+Name=Hitori
+Comment=Play the Hitori puzzle game
# Translators: Search terms to find this application. Do NOT translate or localise the semicolons! The list
MUST also end with a semicolon!
-_Keywords=puzzle;game;logic;grid;
+Keywords=puzzle;game;logic;grid;
Exec=hitori
Icon=hitori
Terminal=false
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..b90d427
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,68 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = \
+ --from-code=UTF-8 \
+ --keyword=_ --flag=_:1:pass-c-format \
+ --keyword=N_ --flag=N_:1:pass-c-format \
+ --flag=g_log:3:c-format --flag=g_logv:3:c-format \
+ --flag=g_error:1:c-format --flag=g_message:1:c-format \
+ --flag=g_critical:1:c-format --flag=g_warning:1:c-format \
+ --flag=g_print:1:c-format \
+ --flag=g_printerr:1:c-format \
+ --flag=g_strdup_printf:1:c-format --flag=g_strdup_vprintf:1:c-format \
+ --flag=g_printf_string_upper_bound:1:c-format \
+ --flag=g_snprintf:3:c-format --flag=g_vsnprintf:3:c-format \
+ --flag=g_string_sprintf:2:c-format \
+ --flag=g_string_sprintfa:2:c-format \
+ --flag=g_scanner_error:2:c-format \
+ --flag=g_scanner_warn:2:c-format
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
+# package. (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.) Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright. The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = $(PACKAGE_STRING) authors
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = $(PACKAGE_BUGREPORT)
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context. Possible values are "yes" and "no". Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+# --previous to keep previous msgids of translated messages,
+# --quiet to reduce the verbosity.
+MSGMERGE_OPTIONS = --quiet
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cf7353c..d66b04a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,9 +1,8 @@
# List of source files containing translatable strings.
-[encoding: UTF-8]
data/hitori.desktop.in
data/hitori.appdata.xml.in
-[type: gettext/glade]data/hitori-menus.ui
-[type: gettext/glade]data/hitori.ui
+data/hitori-menus.ui
+data/hitori.ui
data/org.gnome.hitori.gschema.xml
src/interface.c
src/main.c
diff --git a/src/interface.c b/src/interface.c
index e08261b..f89e5fb 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -75,7 +75,7 @@ hitori_create_interface (Hitori *hitori)
builder = gtk_builder_new_from_resource ("/org/gnome/Hitori/ui/hitori.ui");
- gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+ gtk_builder_set_translation_domain (builder, PACKAGE);
gtk_builder_connect_signals (builder, hitori);
/* Setup the main window */
diff --git a/src/main.c b/src/main.c
index 1bb1eb8..8e3a776 100644
--- a/src/main.c
+++ b/src/main.c
@@ -94,9 +94,9 @@ constructed (GObject *object)
g_application_set_flags (G_APPLICATION (object), G_APPLICATION_HANDLES_COMMAND_LINE);
/* Localisation */
- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
+ bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
+ textdomain (PACKAGE);
g_set_application_name (_("Hitori"));
gtk_window_set_default_icon_name ("hitori");
@@ -223,8 +223,8 @@ handle_command_line (GApplication *application, GApplicationCommandLine *command
/* Options */
context = g_option_context_new (_("- Play a game of Hitori"));
- g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
- g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+ g_option_context_set_translation_domain (context, PACKAGE);
+ g_option_context_add_main_entries (context, options, PACKAGE);
if (g_option_context_parse (context, &argc, &argv, &error) == TRUE) {
/* Activate the remote instance */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]