[frogr] Migrate away from intltool, use gettext instead



commit f67b12fa5bc0fe645f35f7121c28da6776111bb8
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Fri Aug 12 12:00:35 2016 +0100

    Migrate away from intltool, use gettext instead
    
    This is inline with the current trend of stopping using intltool,
    see https://blogs.gnome.org/mclasen/2016/07/21/using-modern-gettext

 autogen.sh                |    9 +-----
 configure.ac              |   18 ++++++-----
 data/Makefile.am          |   10 ++++--
 data/frogr.appdata.xml.in |   10 +++---
 data/frogr.desktop.in.in  |    8 ++--
 po/Makevars               |   78 +++++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in            |   10 +++---
 po/POTFILES.skip          |    4 --
 src/Makefile.am           |    4 ++
 src/frogr-util.c          |    2 +-
 10 files changed, 115 insertions(+), 38 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index b5a739b..e59eede 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,14 +2,7 @@
 
 set -e
 
-mkdir -p m4
-
-aclocal
-autoconf --force
-autoheader --force
-automake --add-missing --copy --force-missing --foreign
-glib-gettextize --force --copy
-intltoolize --copy --force --automake
+autoreconf --force --install --verbose || exit $?
 
 if test x$NOCONFIGURE = x; then
     ./configure "$@"
diff --git a/configure.ac b/configure.ac
index b39cb20..dd7c6ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,11 @@
 AC_INIT([frogr], [1.1], [msanchez gnome org])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([1.11 foreign])
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_CONFIG_HEADERS([config.h])
-IT_PROG_INTLTOOL([0.35.0])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_SRCDIR([src/main.c])
+AM_MAINTAINER_MODE([enable])
 YELP_HELP_INIT
 
 # Support silent build rules, requires at least automake-1.11. Disable
@@ -136,13 +138,13 @@ else
 fi
 
 # Translations
-FROGR_LOCALE_DIR='${localedir}'
-AM_GLIB_DEFINE_LOCALEDIR([FROGR_LOCALE_DIR])
-AM_GLIB_GNU_GETTEXT
-
-GETTEXT_PACKAGE=frogr
+GETTEXT_PACKAGE=$PACKAGE
 AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
+                   [The prefix for our gettext translation domains.])
+
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION(0.18.3)
 
 # Substitute
 
diff --git a/data/Makefile.am b/data/Makefile.am
index b961eec..4050ab4 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,6 +1,3 @@
-@INTLTOOL_DESKTOP_RULE@
-@INTLTOOL_XML_RULE@
-
 desktopdir = $(datadir)/applications
 desktop_in_files = frogr.desktop.in.in
 desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
@@ -9,10 +6,17 @@ edit = sed -e 's,@BINDIR\@,$(bindir),g' -e 's,@PIXMAPDIR\@,$(datadir)\/pixmaps,g
 frogr.desktop.in: frogr.desktop.in.in
        $(edit) $(srcdir)/frogr.desktop.in.in > $(builddir)/frogr.desktop.in
 
+%.desktop: %.desktop.in
+       msgfmt --desktop -d $(top_srcdir)/po \
+               --template $< -o $@
+
 appdatadir = $(datadir)/appdata
 appdata_in_files = frogr.appdata.xml.in
 appdata_DATA = $(appdata_in_files:.xml.in=.xml)
 
+$(appdata_DATA): $(appdata_in_files)
+       $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
+
 CLEANFILES = \
        $(appdata_DATA) \
        $(desktop_DATA) \
diff --git a/data/frogr.appdata.xml.in b/data/frogr.appdata.xml.in
index 12ffd82..26d1fd5 100644
--- a/data/frogr.appdata.xml.in
+++ b/data/frogr.appdata.xml.in
@@ -5,23 +5,23 @@
   <name>frogr</name>
   <summary>frogr: a Flickr Remote Organizer for GNOME</summary>
   <description>
-    <_p>
+    <p>
       frogr is a small application for the GNOME desktop that allows
       users to manage their accounts in the Flickr image hosting
       website.
-    </_p>
-    <_p>
+    </p>
+    <p>
       It supports all the basic Flickr features, including uploading
       pictures, adding descriptions, setting tags and managing sets
       and groups pools.
-    </_p>
+    </p>
   </description>
   <screenshots>
     <screenshot height="800" width="1280" type="default">
       <image>
         https://wiki.gnome.org/Apps/Frogr?action=AttachFile&amp;do=get&amp;target=frogr-screenshot.png
       </image>
-      <_caption>Screenshot of frogr</_caption>
+      <caption>Screenshot of frogr</caption>
     </screenshot>
   </screenshots>
   <project_license>GPL-3.0</project_license>
diff --git a/data/frogr.desktop.in.in b/data/frogr.desktop.in.in
index 96ee5b2..87b7f5e 100644
--- a/data/frogr.desktop.in.in
+++ b/data/frogr.desktop.in.in
@@ -1,10 +1,10 @@
 [Desktop Entry]
 Version=1.0
 Type=Application
-_Name=frogr
-_GenericName=frogr: a Flickr Remote Organizer for GNOME
-_Comment=Upload and organize photos in Flickr accounts
-_Keywords=Flickr;Image;Picture;Photo;Video;Uploader;
+Name=frogr
+GenericName=frogr: a Flickr Remote Organizer for GNOME
+Comment=Upload and organize photos in Flickr accounts
+Keywords=Flickr;Image;Picture;Photo;Video;Uploader;
 Exec=@BINDIR@/frogr %F
 TryExec=@BINDIR@/frogr
 Terminal=false
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..ee4089a
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,78 @@
+# 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 = --keyword=_ --keyword=N_ --from-code=UTF-8 --keyword=C_:1c,2 --keyword=NC_:1c,2 
--keyword=g_dngettext:2,3
+
+# 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 = Copyright 2009-2016 Mario Sanchez Prada <msanchez gnome org>
+
+# This tells whether or not to prepend "GNU " prefix to the package
+# name that gets inserted into the header of the $(DOMAIN).pot file.
+# Possible values are "yes", "no", or empty.  If it is empty, try to
+# detect it automatically by scanning the files in $(top_srcdir) for
+# "GNU packagename" string.
+PACKAGE_GNU = no
+
+# 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 =
+
+# 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 =
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS =
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+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 ef71cb8..0357ae4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,8 +12,8 @@ src/frogr-details-dialog.c
 src/frogr-file-loader.c
 src/frogr-main-view.c
 src/frogr-settings-dialog.c
-[type: gettext/glade]data/gtkbuilder/frogr-app-menu.xml
-[type: gettext/glade]data/gtkbuilder/frogr-context-menu.xml
-[type: gettext/glade]data/gtkbuilder/frogr-main-view.xml
-[type: gettext/glade]data/gtkbuilder/frogr-menu-bar.xml
-[type: gettext/glade]data/gtkbuilder/frogr-menu-button.xml
+data/gtkbuilder/frogr-app-menu.xml
+data/gtkbuilder/frogr-context-menu.xml
+data/gtkbuilder/frogr-main-view.xml
+data/gtkbuilder/frogr-menu-bar.xml
+data/gtkbuilder/frogr-menu-button.xml
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 56f1fab..f678f14 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,6 +1,2 @@
 data/frogr.desktop.in
 
-# We need to explicitly skip this file or make distcheck will fail due to
-# a bug in intltool (see https://bugs.launchpad.net/intltool/+bug/1117944).
-sub/data/frogr.desktop.in
-
diff --git a/src/Makefile.am b/src/Makefile.am
index c5bdf27..399bd3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,6 +27,10 @@ frogr_LDADD = \
 frogr_CFLAGS = $(FROGR_CFLAGS) \
        -DDATA_DIR=\"$(DATA_DIR)\"
 
+frogr_CPPFLAGS = \
+       -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"        \
+       -DLOCALEDIR=\"$(localedir)\"
+
 if PLATFORM_MAC
 frogr_CFLAGS += -DPLATFORM_MAC
 else
diff --git a/src/frogr-util.c b/src/frogr-util.c
index 12439e9..e24bc55 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -111,7 +111,7 @@ frogr_util_get_locale_dir (void)
     {
 #ifndef PLATFORM_MAC
       /* If not in MacOSX, we trust the defined variable better */
-      locale_dir = g_strdup (FROGR_LOCALE_DIR);
+      locale_dir = g_strdup (LOCALEDIR);
 #endif
 
       /* Fallback for MacOSX and cases where FROGR_LOCALE_DIR was not


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