[telegnome] Migrate from intltool to Gettext



commit d927d98849369fb94a3b839df52d1fa8191dc05e
Author: Colin Watson <cjwatson debian org>
Date:   Wed Jul 6 02:19:16 2016 +0100

    Migrate from intltool to Gettext
    
    Current releases of Gettext can handle all our translation needs.
    
    * .gitignore: Remove intltool-*.
    * Makefile.am (SUBDIRS): Build the current directory first.
    (EXTRA_DIST): Remove intltool-*.
    (DISTCLEANFILES): Remove.
    (@INTLTOOL_DESKTOP_RULE@, @INTLTOOL_XML_RULE@): Replace with open-coded
    versions using msgfmt.
    * autogen.sh: Remove calls to glib-gettextize and intltoolize.
    * configure.ac (AM_GLIB_GNU_GETTEXT): Replace with ...
    (AM_GNU_GETTEXT_VERSION, AM_GNU_GETTEXT): ... these.
    (AM_GLIB_DEFINE_LOCALEDIR): Remove; the output variable is no longer
    used.
    (IT_PROG_INTLTOOL): Remove.
    * po/.gitignore: Remove .intltool-merge-cache.  Add remove-potcdate.sed.
    Remove stamp-cat-id and stamp-it.  Add stamp-po.
    * po/Makevars: New file.
    * po/POTFILES.in: Remove intltool-specific "[type: gettext/glade]"
    annotations.
    * po/POTFILES.skip: Remove.
    * src/menus.ui, src/prefs.ui, src/telegnome.ui: Move copyright comment
    after XML declaration.
    * telegnome.appdata.xml.in, telegnome.desktop.in: Remove
    intltool-specific underscore prefixes.

 .gitignore               |    3 --
 Makefile.am              |   19 ++++++-------
 autogen.sh               |    2 -
 configure.ac             |    5 +--
 po/.gitignore            |    5 +--
 po/Makevars              |   63 ++++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in           |    6 ++--
 po/POTFILES.skip         |    1 -
 src/menus.ui             |    3 +-
 src/prefs.ui             |    3 +-
 src/telegnome.ui         |    3 +-
 telegnome.appdata.xml.in |    8 +++---
 telegnome.desktop.in     |    4 +-
 13 files changed, 91 insertions(+), 34 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a515eb3..d285155 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,9 +17,6 @@ config.sub
 configure
 depcomp
 install-sh
-intltool-extract*
-intltool-merge*
-intltool-update*
 m4
 missing
 mkinstalldirs
diff --git a/Makefile.am b/Makefile.am
index ab0f949..3d932ad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,24 +1,23 @@
-SUBDIRS = data src po pixmaps doc
+SUBDIRS = . data src po pixmaps doc
 
 EXTRA_DIST = \
        ChangeLog-pre-2-0 \
        MAINTAINERS \
-       intltool-extract.in \
-       intltool-merge.in \
-       intltool-update.in \
        telegnome.doap
 
-DISTCLEANFILES = intltool-extract intltool-merge intltool-update
-
 appsdir=$(datadir)/applications
 apps_in_files = telegnome.desktop.in
-apps_DATA = $(apps_in_files:.desktop.in=.desktop)
-@INTLTOOL_DESKTOP_RULE@
+apps_DATA = telegnome.desktop
+
+telegnome.desktop: telegnome.desktop.in
+       $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 
 appstreamdir = $(datadir)/appdata
 appstream_in_files = telegnome.appdata.xml.in
-appstream_DATA = $(appstream_in_files:.xml.in=.xml)
-@INTLTOOL_XML_RULE@
+appstream_DATA = telegnome.appdata.xml
+
+telegnome.appdata.xml: telegnome.appdata.xml.in
+       $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 EXTRA_DIST += $(apps_in_files) $(appstream_in_files)
 CLEANFILES = $(apps_DATA) $(appstream_DATA)
diff --git a/autogen.sh b/autogen.sh
index 8f2a5a0..abadb9a 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -23,8 +23,6 @@ if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
 fi
 
 aclocal --install || exit 1
-glib-gettextize --force --copy || exit 1
-intltoolize --force --copy --automake || exit 1
 autoreconf --verbose --force --install || exit 1
 
 cd "$olddir"
diff --git a/configure.ac b/configure.ac
index 839ce05..399791d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,9 +42,8 @@ AC_SUBST(PROGRAMS_TELEGNOME)
 GETTEXT_PACKAGE=telegnome
 AC_SUBST([GETTEXT_PACKAGE])
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
-AM_GLIB_GNU_GETTEXT
-AM_GLIB_DEFINE_LOCALEDIR([GNOMELOCALEDIR])
-IT_PROG_INTLTOOL([0.35.0], [no-xml])
+AM_GNU_GETTEXT_VERSION([0.19.7])
+AM_GNU_GETTEXT([external])
 
 AC_CONFIG_FILES([Makefile 
           data/Makefile
diff --git a/po/.gitignore b/po/.gitignore
index 4dc77d8..02a2563 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -1,7 +1,6 @@
 *.gmo
 *.mo
 *.pot
-.intltool-merge-cache
 Makefile.in.in
 Makevars.template
 POTFILES
@@ -13,6 +12,6 @@ en@quot.header
 insert-header.sin
 messages
 quot.sed
+remove-potcdate.sed
 remove-potcdate.sin
-stamp-cat-id
-stamp-it
+stamp-po
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..06005a5
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,63 @@
+# 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.
+# XXX cjwatson 2016-07-06: This is clumsy: we just want to remove Icon from
+# the desktop defaults, but to achieve that we have to re-specify everything
+# else.  These keywords are the current defaults for Vala and Desktop
+# (except for Icon) as of Gettext 0.19.7.
+XGETTEXT_OPTIONS = --from-code=UTF-8 \
+       --keyword \
+       --keyword=_ --keyword=Q_ --keyword=N_ --keyword=NC_ \
+       --keyword=dgettext:2 --keyword=dcgettext:2 \
+       --keyword=ngettext:1,2 --keyword=dngettext:2,3 \
+       --keyword=dpgettext:2c,3 --keyword=dpgettext2:2c,3 \
+       --keyword=Name --keyword=GenericName \
+       --keyword=Comment --keyword=Keywords
+
+# 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 = Colin Watson <cjwatson debian org>
+
+# 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 = Colin Watson <cjwatson debian org>
+
+# 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 =
+
+# Ignore the timestamp of the .pot file, as git clones do not have
+# deterministic timestamps, and .po files are updated by translators
+# (only) in GNOME projects.
+PO_DEPENDS_ON_POT = no
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = no
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 846f9b6..1fca27a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,8 +2,8 @@
 # Please keep this file sorted alphabetically.
 data/org.gnome.telegnome.gschema.xml
 src/gui.vala
-[type: gettext/glade] src/menus.ui
-[type: gettext/glade] src/prefs.ui
-[type: gettext/glade] src/telegnome.ui
+src/menus.ui
+src/prefs.ui
+src/telegnome.ui
 telegnome.appdata.xml.in
 telegnome.desktop.in
diff --git a/src/menus.ui b/src/menus.ui
index 1d0e926..a02ec6c 100644
--- a/src/menus.ui
+++ b/src/menus.ui
@@ -1,3 +1,5 @@
+<?xml version="1.0"?>
+
 <!--
  * Copyright (C) 2016 Colin Watson <cjwatson debian org>
  *
@@ -16,7 +18,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 -->
 
-<?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <menu id="menubar">
diff --git a/src/prefs.ui b/src/prefs.ui
index b4a04f2..030897c 100644
--- a/src/prefs.ui
+++ b/src/prefs.ui
@@ -1,3 +1,5 @@
+<?xml version="1.0"?>
+
 <!--
  * Copyright (C) 2016 Colin Watson <cjwatson debian org>
  *
@@ -16,7 +18,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 -->
 
-<?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkListStore" id="prefs_channel_store">
diff --git a/src/telegnome.ui b/src/telegnome.ui
index 1648c28..a3ab64a 100644
--- a/src/telegnome.ui
+++ b/src/telegnome.ui
@@ -1,3 +1,5 @@
+<?xml version="1.0"?>
+
 <!--
  * Copyright (C) 2016 Colin Watson <cjwatson debian org>
  *
@@ -16,7 +18,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 -->
 
-<?xml version="1.0"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkApplicationWindow" id="main_window">
diff --git a/telegnome.appdata.xml.in b/telegnome.appdata.xml.in
index e23de98..08abcfb 100644
--- a/telegnome.appdata.xml.in
+++ b/telegnome.appdata.xml.in
@@ -24,14 +24,14 @@
   <id>telegnome.desktop</id>
   <metadata_license>MIT</metadata_license>
   <project_license>GPL-2.0+</project_license>
-  <_name>TeleGNOME</_name>
-  <_summary>Viewer for Teletext pages</_summary>
+  <name>TeleGNOME</name>
+  <summary>Viewer for Teletext pages</summary>
 
   <description>
-    <_p>
+    <p>
       TeleGNOME is a program to display teletext pages over the internet,
       based on image feeds from a variety of broadcasters.
-    </_p>
+    </p>
   </description>
 
   <url type="homepage">http://telegnome.sourceforge.net/</url>
diff --git a/telegnome.desktop.in b/telegnome.desktop.in
index 31bf454..e2717b3 100644
--- a/telegnome.desktop.in
+++ b/telegnome.desktop.in
@@ -1,6 +1,6 @@
 [Desktop Entry]
-_Name=TeleGNOME
-_Comment=Viewer for Teletext pages
+Name=TeleGNOME
+Comment=Viewer for Teletext pages
 TryExec=telegnome
 Exec=telegnome
 Icon=telegnome.png


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]