[PATCH 6/7] Use gettext to process glade files.

David Shea dshea at redhat.com
Fri Nov 8 14:57:33 UTC 2013


Gettext 0.18.3 adds support for translation contexts in glade, so we no
longer need to process glade files with intltool.

0.18.3 also adds JavaScript support, so we no longer have to lie about
the language for the fedora-welcome file.
---
 .gitignore       |  1 -
 anaconda.spec.in |  4 +++-
 configure.ac     |  3 ++-
 po/POTFILES.in   | 53 ++++++++++++++++++++++++++---------------------------
 po/Rules-extract | 17 ++---------------
 5 files changed, 33 insertions(+), 45 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8a10aaa..b3852e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@
 *.bak
 *.desktop.in.h
 *.gir
-*.glade.h
 *.la
 *.lo
 *.o
diff --git a/anaconda.spec.in b/anaconda.spec.in
index a3be24c..9ec4ee0 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -17,7 +17,9 @@ Source0: %{name}-%{version}.tar.bz2
 
 # Versions of required components (done so we make sure the buildrequires
 # match the requires versions of things).
-%define gettextver 0.18.1
+
+# Also update in AM_GNU_GETTEXT_VERSION in configure.ac
+%define gettextver 0.18.3
 %define gconfversion 2.28.1
 %define intltoolver 0.31.2-3
 %define libnlver 1.0
diff --git a/configure.ac b/configure.ac
index 412de1b..76b6985 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,8 @@ INTLTOOL_DESKTOP_RULE='%.desktop:  %.desktop.in  $(INTLTOOL_MERGE) $(wildcard $(
 AC_SUBST(INTLTOOL_DESKTOP_RULE)
 
 AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.1])
+# Also update in gettextver in anaconda.spec.in
+AM_GNU_GETTEXT_VERSION([0.18.3])
 
 # Checks for libraries.
 AC_CHECK_LIB([X11], [XGetWindowAttributes],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c23835a..a1a7f74 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -95,36 +95,35 @@ widgets/src/Lightbox.c
 widgets/src/glade-adaptor.c
 widgets/src/tz.c
 
+# Interface files.
+pyanaconda/ui/gui/spokes/advanced_user.glade
+pyanaconda/ui/gui/spokes/datetime_spoke.glade
+pyanaconda/ui/gui/spokes/filter.glade
+pyanaconda/ui/gui/spokes/network.glade
+pyanaconda/ui/gui/spokes/software.glade
+pyanaconda/ui/gui/spokes/storage.glade
+pyanaconda/ui/gui/spokes/keyboard.glade
+pyanaconda/ui/gui/spokes/langsupport.glade
+pyanaconda/ui/gui/spokes/password.glade
+pyanaconda/ui/gui/spokes/source.glade
+pyanaconda/ui/gui/spokes/welcome.glade
+pyanaconda/ui/gui/spokes/user.glade
+pyanaconda/ui/gui/spokes/custom.glade
+pyanaconda/ui/gui/spokes/advstorage/fcoe.glade
+pyanaconda/ui/gui/spokes/advstorage/iscsi.glade
+pyanaconda/ui/gui/spokes/lib/cart.glade
+pyanaconda/ui/gui/spokes/lib/detailederror.glade
+pyanaconda/ui/gui/spokes/lib/passphrase.glade
+pyanaconda/ui/gui/spokes/lib/refresh.glade
+pyanaconda/ui/gui/spokes/lib/resize.glade
+pyanaconda/ui/gui/spokes/lib/summary.glade
+pyanaconda/ui/gui/main.glade
+pyanaconda/ui/gui/hubs/summary.glade
+pyanaconda/ui/gui/hubs/progress.glade
+
 # For file types that gettext doesn't understand, list <filename>.h and
 # use Rules-extract to extract the strings into a C-style header.
 
-# Interface files.
-# gettext doesn't fully support glade3
-pyanaconda/ui/gui/spokes/advanced_user.glade.h
-pyanaconda/ui/gui/spokes/datetime_spoke.glade.h
-pyanaconda/ui/gui/spokes/filter.glade.h
-pyanaconda/ui/gui/spokes/network.glade.h
-pyanaconda/ui/gui/spokes/software.glade.h
-pyanaconda/ui/gui/spokes/storage.glade.h
-pyanaconda/ui/gui/spokes/keyboard.glade.h
-pyanaconda/ui/gui/spokes/langsupport.glade.h
-pyanaconda/ui/gui/spokes/password.glade.h
-pyanaconda/ui/gui/spokes/source.glade.h
-pyanaconda/ui/gui/spokes/welcome.glade.h
-pyanaconda/ui/gui/spokes/user.glade.h
-pyanaconda/ui/gui/spokes/custom.glade.h
-pyanaconda/ui/gui/spokes/advstorage/fcoe.glade.h
-pyanaconda/ui/gui/spokes/advstorage/iscsi.glade.h
-pyanaconda/ui/gui/spokes/lib/cart.glade.h
-pyanaconda/ui/gui/spokes/lib/detailederror.glade.h
-pyanaconda/ui/gui/spokes/lib/passphrase.glade.h
-pyanaconda/ui/gui/spokes/lib/refresh.glade.h
-pyanaconda/ui/gui/spokes/lib/resize.glade.h
-pyanaconda/ui/gui/spokes/lib/summary.glade.h
-pyanaconda/ui/gui/main.glade.h
-pyanaconda/ui/gui/hubs/summary.glade.h
-pyanaconda/ui/gui/hubs/progress.glade.h
-
 # liveinst source files
 data/liveinst/liveinst.desktop.in.h
 data/liveinst/console.apps/liveinst.h
diff --git a/po/Rules-extract b/po/Rules-extract
index 568247d..f7fa669 100644
--- a/po/Rules-extract
+++ b/po/Rules-extract
@@ -7,20 +7,8 @@
 # input file. --local will output files in a tmp/ directory relative to the
 # current working directory.
 #
-# intltool-extract adds "no-c-format" to any lines it finds containing format
-# specifiers, which disables the xgettext warnings on format errors. Assume
-# instead that anything in a glade file is going to be used as a python format
-# string so that our gettext tests work.
-#
 # All output files need to be in $srcdir for gettext to be able to find them.
 
-DISTFILES.common.extra2 = Rules-extract
-
-%.glade.h: %.glade
-	@intltool-extract -q --type=gettext/glade -l $< && \
-	sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \
-	rm -f tmp/$$(basename $@)
-
 %.desktop.in.h: %.desktop.in
 	@intltool-extract -q --type=gettext/keys -l $< && \
 	sed 's/no-c-format/python-format/' < tmp/$$(basename $@) > $@ && \
@@ -38,18 +26,17 @@ DISTFILES.common.extra2 = Rules-extract
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --omit-header --directory=$(top_srcdir) \
 		--language=Python -o $@ $${input_file##$(top_srcdir)/}
 
-# This file is actually JavaScript, but C is close enough
 %fedora-welcome.po: %fedora-welcome
 	@input_file="$<" && \
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --omit-header --directory=$(top_srcdir) \
-		--language=C -o $@ $${input_file##$(top_srcdir)/}
+		--language=JavaScript -o $@ $${input_file##$(top_srcdir)/}
 
 mostlyclean: mostlyclean-extract
 mostlyclean-extract:
 	rm -f \
 		$(top_srcdir)/anaconda.po $(top_srcdir)/data/liveinst/gnome/fedora-welcome.po \
 		$(top_srcdir)/data/liveinst/console.apps/liveinst.h
-	find $(top_srcdir) \( -name '*.glade.h' -o -name '*.desktop.in.h' \) \
+	find $(top_srcdir) \( -name '*.desktop.in.h' \) \
 		-exec rm -f {} \;
 
 mostlyclean: mostlyclean-extract
-- 
1.8.4.2



More information about the anaconda-patches mailing list