[gnome-boxes/wip/feborges/meson: 12/13] Migrate from Intltool to Gettext



commit 903499a5f47024e3e406515e68cb2d346996c7b7
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Jun 20 13:36:09 2017 +0200

    Migrate from Intltool to Gettext
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783832

 Makefile.am                         |   12 -----
 autogen.sh                          |    1 -
 configure.ac                        |    4 +-
 data/Makefile.am                    |   15 ++++--
 data/org.gnome.Boxes.appdata.xml.in |   12 +++---
 data/org.gnome.Boxes.desktop.in.in  |    8 ++--
 po/Makevars                         |   78 +++++++++++++++++++++++++++++++++++
 po/POTFILES.in                      |   46 ++++++++++----------
 src/Makefile.am                     |    2 +-
 src/config.vapi                     |    2 +-
 src/main.vala                       |    2 +-
 11 files changed, 126 insertions(+), 56 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 47cdf0f..b50cdbd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,17 +3,7 @@ NULL =
 
 SUBDIRS = data help libgd src po vapi
 
-INTLTOOL_FILES =                               \
-       intltool-extract.in                     \
-       intltool-merge.in                       \
-       intltool-update.in                      \
-       $(NULL)
-
 DISTCLEANFILES =                               \
-       intltool-extract                        \
-       intltool-merge                          \
-       intltool-update                         \
-       po/.intltool-merge-cache                \
        $(NULL)
 
 EXTRA_DIST =                                   \
@@ -24,7 +14,6 @@ EXTRA_DIST =                                  \
        build-aux/git-version-gen               \
        m4/boxes.m4                             \
        .version                                \
-       $(INTLTOOL_FILES)                       \
        $(NULL)
 
 MAINTAINERCLEANFILES =                         \
@@ -41,7 +30,6 @@ MAINTAINERCLEANFILES =                                \
        build-aux/ltmain.sh                     \
        build-aux/missing                       \
        build-aux/mkinstalldirs                 \
-       m4/intltool.m4                          \
        m4/libtool.m4                           \
        m4/ltoptions.m4                         \
        m4/ltsugar.m4                           \
diff --git a/autogen.sh b/autogen.sh
index 5b679c9..8cd928b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -10,7 +10,6 @@ olddir=`pwd`
 cd "$srcdir"
 git submodule update --init --recursive
 autoreconf -v --force --install
-intltoolize -f
 
 cd "$olddir"
 if [ -z "$NOCONFIGURE" ]; then
diff --git a/configure.ac b/configure.ac
index ee90da4..90c5695 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,8 +31,8 @@ LT_INIT([disable-static])
 # Pkg-config
 PKG_PROG_PKG_CONFIG([0.22])
 
-# i18 support
-IT_PROG_INTLTOOL(0.40.0)
+AM_GNU_GETTEXT_VERSION([0.19.8])
+AM_GNU_GETTEXT([external])
 
 GETTEXT_PACKAGE=AC_PACKAGE_NAME
 AC_SUBST(GETTEXT_PACKAGE)
diff --git a/data/Makefile.am b/data/Makefile.am
index 62593cb..3a878b0 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -4,19 +4,24 @@ SUBDIRS = icons osinfo
 desktopdir       = $(datadir)/applications
 desktop_in_files = org.gnome.Boxes.desktop.in
 desktop_DATA     = $(desktop_in_files:.desktop.in=.desktop)
-@INTLTOOL_DESKTOP_RULE@
+
+$(desktop_DATA): %.desktop: %.desktop.in
+       $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 
 all-local: $(desktop_DATA)
        @$(DESKTOP_FILE_VALIDATE) $(desktop_DATA)
 
 gsettings_SCHEMAS = org.gnome.boxes.gschema.xml
-@INTLTOOL_XML_NOMERGE_RULE@
-@GSETTINGS_RULES@
+
+$(gsettings_SCHEMAS): org.gnome.boxes.gschemal.xml.in
+       $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 appdatadir = $(datadir)/appdata
 appdata_in_file = org.gnome.Boxes.appdata.xml.in
 appdata_DATA = $(appdata_in_file:.xml.in=.xml)
-@INTLTOOL_XML_RULE@
+
+$(appdata_DATA): $(appdata_in_file)
+       $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 sourcedir         = $(datadir)/gnome-boxes/sources
 source_DATA       = QEMU_Session
@@ -78,7 +83,7 @@ MAINTAINERCLEANFILES =                                \
        $(NULL)
 
 gnome-boxes-search-provider.ini: gnome-boxes-search-provider.ini.in
-       LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
+       $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 
 org.gnome.Boxes.SearchProvider.service: org.gnome.Boxes.SearchProvider.service.in Makefile
        $(AM_V_GEN) [ -d $(@D) ] || $(mkdir_p) $(@D) ; \
diff --git a/data/org.gnome.Boxes.appdata.xml.in b/data/org.gnome.Boxes.appdata.xml.in
index 9436d32..d70f4c2 100644
--- a/data/org.gnome.Boxes.appdata.xml.in
+++ b/data/org.gnome.Boxes.appdata.xml.in
@@ -2,22 +2,22 @@
 <component type="desktop">
   <id>org.gnome.Boxes.desktop</id>
   <metadata_license>CC0-1.0</metadata_license>
-  <_name>GNOME Boxes</_name>
-  <_summary>Simple remote and virtual machines</_summary>
+  <name>GNOME Boxes</name>
+  <summary>Simple remote and virtual machines</summary>
   <description>
-    <_p>
+    <p>
       A simple GNOME 3 application to access remote or virtual systems. Unlike
       some other virtual machine management software, Boxes is targeted towards
       typical desktop end-users. For this reason, Boxes will not provide many
       advanced options to tweak virtual machines. Instead Boxes will focus on
       getting things working out of the box with very little input from user.
-    </_p>
-    <_p>
+    </p>
+    <p>
       You want to install Boxes if you just want a very safe and easy way to try
       out new operating systems or new (potentially unstable) versions of your
       favorite operating system(s), or need to connect to a remote machine (for
       example, in your office).
-    </_p>
+    </p>
   </description>
   <screenshots>
     <screenshot height="485" width="800" type="default">
diff --git a/data/org.gnome.Boxes.desktop.in.in b/data/org.gnome.Boxes.desktop.in.in
index 99ec389..c0df280 100644
--- a/data/org.gnome.Boxes.desktop.in.in
+++ b/data/org.gnome.Boxes.desktop.in.in
@@ -1,8 +1,8 @@
 [Desktop Entry]
-_Name=Boxes
-_GenericName=Virtual machine viewer/manager
-_Comment=View and use virtual machines
-_Keywords=virtual machine;vm;
+Name=Boxes
+GenericName=Virtual machine viewer/manager
+Comment=View and use virtual machines
+Keywords=virtual machine;vm;
 Exec=gnome-boxes %U
 Icon=gnome-boxes
 Terminal=false
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..5b96a1f
--- /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 = --from-code=UTF-8 --keyword=_ --keyword=N_
+
+# 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 = Free Software Foundation, Inc.
+
+# 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 =
+
+# 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 8152369..99d7bb9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,30 +2,30 @@
 # Please keep this file sorted alphabetically.
 data/org.gnome.Boxes.appdata.xml.in
 data/org.gnome.Boxes.desktop.in.in
-[type: gettext/ini]data/gnome-boxes-search-provider.ini.in
+data/gnome-boxes-search-provider.ini.in
 data/org.gnome.boxes.gschema.xml.in
-[type: gettext/glade]data/ui/app-window.ui
-[type: gettext/glade]data/ui/auth-notification.ui
-[type: gettext/glade]data/ui/collection-filter-switcher.ui
-[type: gettext/glade]data/ui/collection-toolbar.ui
-[type: gettext/glade]data/ui/display-toolbar.ui
-[type: gettext/glade]data/ui/empty-boxes.ui
-[type: gettext/glade]data/ui/kbd-shortcuts-window.ui
-[type: gettext/glade]data/ui/menus.ui
-[type: gettext/glade]data/ui/properties-toolbar.ui
-[type: gettext/glade]data/ui/properties-window.ui
-[type: gettext/glade]data/ui/selectionbar.ui
-[type: gettext/glade]data/ui/selection-toolbar.ui
-[type: gettext/glade]data/ui/shared-folder-popover.ui
-[type: gettext/glade]data/ui/snapshot-list-row.ui
-[type: gettext/glade]data/ui/topbar.ui
-[type: gettext/glade]data/ui/unattended-setup-box.ui
-[type: gettext/glade]data/ui/wizard-media-entry.ui
-[type: gettext/glade]data/ui/wizard-scrolled.ui
-[type: gettext/glade]data/ui/wizard-source.ui
-[type: gettext/glade]data/ui/wizard-toolbar.ui
-[type: gettext/glade]data/ui/wizard.ui
-[type: gettext/glade]data/ui/wizard-window.ui
+data/ui/app-window.ui
+data/ui/auth-notification.ui
+data/ui/collection-filter-switcher.ui
+data/ui/collection-toolbar.ui
+data/ui/display-toolbar.ui
+data/ui/empty-boxes.ui
+data/ui/kbd-shortcuts-window.ui
+data/ui/menus.ui
+data/ui/properties-toolbar.ui
+data/ui/properties-window.ui
+data/ui/selectionbar.ui
+data/ui/selection-toolbar.ui
+data/ui/shared-folder-popover.ui
+data/ui/snapshot-list-row.ui
+data/ui/topbar.ui
+data/ui/unattended-setup-box.ui
+data/ui/wizard-media-entry.ui
+data/ui/wizard-scrolled.ui
+data/ui/wizard-source.ui
+data/ui/wizard-toolbar.ui
+data/ui/wizard.ui
+data/ui/wizard-window.ui
 src/actions-popover.vala
 src/app.vala
 src/app-window.vala
diff --git a/src/Makefile.am b/src/Makefile.am
index 312f9e0..182ff92 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,7 +6,7 @@ MAINTAINERCLEANFILES = *.stamp
 cachedir=/var/cache/
 AM_CPPFLAGS =                                          \
        -include config.h                               \
-       -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
+       -DLOCALEDIR=\""$(localedir)"\"  \
        -DDATADIR=\""$(datadir)"\"                      \
        -DCACHEDIR=\""$(cachedir)"\"                    \
        $(DISABLE_DEPRECATED)                           \
diff --git a/src/config.vapi b/src/config.vapi
index 36e7065..021e959 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -4,7 +4,7 @@ namespace Config {
         public const string PACKAGE_DATADIR;
         public const string PACKAGE_TARNAME;
         public const string GETTEXT_PACKAGE;
-        public const string GNOMELOCALEDIR;
+        public const string LOCALEDIR;
         public const string DATADIR;
         public const string CACHEDIR;
         public const string PACKAGE_BUGREPORT;
diff --git a/src/main.vala b/src/main.vala
index 5c5d242..53bbf05 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -66,7 +66,7 @@ private async void run_checks () {
 }
 
 public int main (string[] args) {
-    Intl.bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+    Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
     Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
     Intl.textdomain (GETTEXT_PACKAGE);
     GLib.Environment.set_application_name (_("Boxes"));


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