[sound-juicer] Stop translating icon name



commit 10f423ba7640ab4612e337c00c92fe08e1da4bc0
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.
    
    Note that we need to leave the translator comment about the icon name
    in the desktop file for users of damned-lies as it does not run make
    to extract the strings and ends up extracting the icon name. The changes
    to the makefile rule to build the translated desktop file should protect
    us from any accidental translations.
    
    ¹ 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 |   10 ++++++++++
 po/remove-icon-name.sed   |    7 +++++++
 3 files changed, 21 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..f7b52e4
--- /dev/null
+++ b/po/Rules-remove-icon-name
@@ -0,0 +1,10 @@
+remove-icon-name.stamp : $(srcdir)/$(DOMAIN).pot $(srcdir)/remove-icon-name.sed
+       sed -f $(srcdir)/remove-icon-name.sed -i $(srcdir)/$(DOMAIN).pot
+       touch $@
+
+stamp-po : remove-icon-name.stamp
+
+Makefile : $(srcdir)/Rules-remove-icon-name
+
+DISTEXTRA += Rules-remove-icon-name \
+            remove-icon-name.sed
diff --git a/po/remove-icon-name.sed b/po/remove-icon-name.sed
new file mode 100644
index 0000000..5173408
--- /dev/null
+++ b/po/remove-icon-name.sed
@@ -0,0 +1,7 @@
+/^#. Translators: Do NOT translate or transliterate this text (this is an icon file name)!/{
+N
+N
+N
+N
+/^#. Translators: Do NOT translate or transliterate this text (this is an icon file name)!\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]