Using gettext for more than source code translations

flo.xfce at gmx-topmail.de flo.xfce at gmx-topmail.de
Sat Oct 29 17:14:12 CEST 2016


Since version 0.19 gettext has support for more file formats than only
source code. This makes the use of intltool in most cases obsolte.
(Maybe even in all our cases, I haven't checked).
Here is a patch for mousepad (which is my experimental platform for such
patches) which uses gettext to generate the localized desktop file. I
don't see the point of needing two tools where one is enough. Intltool
was developed for the Gnome project to overcome gettext's shortcomings,
but those were resolved and now even the creator of intltool, the Gnome
project, is moving towards a gettext-only build chain.
Please let me know if you are interested in more of these patches for
other Xfce components, if you are willing to merge them. Please note: I
haven't touched the dev-tools yet, intltool is still necessary for autogen.

Kind regards

diff --git a/Makefile.am b/Makefile.am
index 964dd9a..f23b1d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,8 +14,8 @@ desktop_in_files =
$(desktop_in_in_files:.desktop.in.in=.desktop.in)
 %.desktop.in: %.desktop.in.in
 	sed -e "s,\@libexecdir\@,$(libexecdir),g" < $< > $@
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
- at INTLTOOL_DESKTOP_RULE@
+%.desktop: %.desktop.in
+	$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 .PHONY: ChangeLog

 ChangeLog: Makefile
@@ -26,15 +26,9 @@ ChangeLog: Makefile
 dist-hook: ChangeLog

 EXTRA_DIST =									\
-	intltool-extract.in							\
-	intltool-merge.in							\
-	intltool-update.in							\
 	$(desktop_in_in_files)

 DISTCLEANFILES =								\
-	intltool-extract							\
-	intltool-merge								\
-	intltool-update								\
 	$(desktop_in_files)							\
 	$(desktop_DATA)

diff --git a/configure.ac.in b/configure.ac.in
index 3f75bad..b701053 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -47,7 +47,6 @@ AC_PROG_CC()
 AM_PROG_CC_C_O()
 AC_PROG_LD()
 AC_PROG_INSTALL()
-AC_PROG_INTLTOOL()
 AC_CHECK_PROGS([PERL], [perl5 perl])

 dnl **************************
@@ -78,6 +77,7 @@ dnl ******************************
 dnl *** Check for i18n support ***
 dnl ******************************
 XDT_I18N([@LINGUAS@])
+AM_GNU_GETTEXT_VERSION([0.19.7])

 dnl ***********************************
 dnl *** Check for required packages ***
diff --git a/mousepad.desktop.in.in b/mousepad.desktop.in.in
index 96ca08d..0c4af3b 100644
--- a/mousepad.desktop.in.in
+++ b/mousepad.desktop.in.in
@@ -1,8 +1,8 @@

 [Desktop Entry]
-_Name=Mousepad
-_Comment=Simple Text Editor
-_GenericName=Text Editor
+Name=Mousepad
+Comment=Simple Text Editor
+GenericName=Text Editor
 Exec=mousepad %F
 Icon=accessories-text-editor
 Terminal=false
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..b26df1b
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,2 @@
+# Set of available languages.
+ar ast bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu id is it
ja kk ko lt ms nb nl nn oc pl pt pt_BR ro ru sk sr sv te th tr ug uk
zh_CN zh_TW



More information about the Xfce4-dev mailing list