[sound-juicer/wip/gettext: 3/5] Stop translating icon name



commit 51834a2614de5dce723cd20fb019b71e27d047dc
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Tue Jun 21 18:45:10 2016 +0100

    Stop translating icon name
    
    Gettext automatically extracts the icon name from the desktop file for
    translation¹ because it is a locale string in the desktop entry
    specification.² However we don’t want it translated. As it’s not
    possible to specify per-language keywords to stop xgettext from
    extracting the string use sed to remove it from the pot file.
    
    ¹ https://savannah.gnu.org/support/?108887
    ² http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769623

 data/Makefile.am          |    5 ++++-
 po/Rules-remove-icon-name |    5 +++++
 po/remove-icon-name.sed   |    6 ++++++
 3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 1da03fc..050fe04 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -2,8 +2,11 @@ desktopdir = $(datadir)/applications
 desktop_in_files = data/sound-juicer.desktop.in.in
 desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
 
+# Use a custom set of keywords to prevent the icon name from being translated
 $(desktop_DATA): data/sound-juicer.desktop.in
-       $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
+       $(AM_V_GEN)$(MSGFMT) --desktop --keyword= --keyword=Name             \
+               --keyword=GenericName --keyword=Comment --keyword=Keywords   \
+               --template $< -d $(top_srcdir)/po -o $@
 
 @APPSTREAM_XML_RULES@
 appstream_XML = $(appstream_in_files:.xml.in=.xml)
diff --git a/po/Rules-remove-icon-name b/po/Rules-remove-icon-name
new file mode 100644
index 0000000..d20e314
--- /dev/null
+++ b/po/Rules-remove-icon-name
@@ -0,0 +1,5 @@
+remove-icon-name.stamp : $(srcdir)/$(DOMAIN).pot
+       sed -f $(srcdir)/remove-icon-name.sed -i $(srcdir)/$(DOMAIN).pot
+       touch $@
+
+stamp-po : remove-icon-name.stamp
diff --git a/po/remove-icon-name.sed b/po/remove-icon-name.sed
new file mode 100644
index 0000000..5f80aed
--- /dev/null
+++ b/po/remove-icon-name.sed
@@ -0,0 +1,6 @@
+/^#: data\/sound-juicer.desktop.in.in:/{
+N
+N
+N
+/^#: data\/sound-juicer.desktop.in.in:[0-9]*\nmsgid "sound-juicer"\nmsgstr ""\n$/d
+}


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