Version 0.20.2 - April 2020
+* Programming languages support:
+ - Desktop Entry:
+ The value of the 'Icon' property is no longer extracted into the POT file
+ by xgettext. The documentation explains how to localize icons.
+
* Runtime behaviour:
- Fixed a multithread-safety bug on Cygwin and native Windows.
For more information, see the example @code{hello-c-gnome3}.
+@menu
+* Icons:: Handling icons
+@end menu
+
+@node Icons
+@subsubsection How to handle icons in Desktop Entry files
+
+Icons are generally locale dependent, for the following reasons:
+
+@itemize @bullet
+@item
+Icons may contain signs that are considered rude in some cultures. For
+example, the high-five sign, in some cultures, is perceived as an
+unfriendly ``stop'' sign.
+@item
+Icons may contain metaphors that are culture specific. For example, a
+mailbox in the U.S. looks different than mailboxes all around the world.
+@item
+Icons may need to be mirrored for right-to-left locales.
+@item
+Icons may contain text strings (a bad practice, but anyway).
+@end itemize
+
+However, icons are not covered by GNU gettext localization, because
+@itemize @bullet
+@item
+Icons cannot be easily embedded in PO files,
+@item
+The need to localize an icon is rare, and the ability to do so in a PO
+file would introduce translator mistakes.
+@c https://lists.freedesktop.org/archives/xdg/2019-June/014168.html
+@end itemize
+
+Desktop Entry files may contain an @samp{Icon} property, and this
+property is localizable. If a translator wishes to localize an icon,
+she should do so by bypassing the normal workflow with PO files:
+@enumerate
+@item
+The translator contacts the package developers directly, sending them
+the icon appropriate for her locale, with a request to change the
+template file.
+@item
+The package developers add the icon file to their repository, and a
+line
+@smallexample
+Icon[@var{locale}]=@var{icon_file_name}
+@end smallexample
+@noindent
+to the template file.
+@end enumerate
+@noindent
+This line remains in place when this template file is merged with the
+translators' PO files, through @code{msgfmt}.
+
@node XML
@subsection XML files
@item
For Desktop: @code{Name}, @code{GenericName}, @code{Comment},
-@code{Icon}, @code{Keywords}.
+@code{Keywords}.
@end itemize
To disable the default keyword specifications, the option @samp{-k} or
/* Reading Desktop Entry files.
- Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2018 Free
+ Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009, 2014-2019 Free
Software Foundation, Inc.
This file was written by Daiki Ueno <ueno@gnu.org>.
desktop_add_keyword (keywords, "Name", false);
desktop_add_keyword (keywords, "GenericName", false);
desktop_add_keyword (keywords, "Comment", false);
+#if 0 /* Icon values are localizable, but not supported by xgettext. */
desktop_add_keyword (keywords, "Icon", false);
+#endif
desktop_add_keyword (keywords, "Keywords", true);
}
/* xgettext Desktop Entry backend.
- Copyright (C) 2014, 2018 Free Software Foundation, Inc.
+ Copyright (C) 2014, 2018-2019 Free Software Foundation, Inc.
This file was written by Daiki Ueno <ueno@gnu.org>, 2014.
/* The syntax of a Desktop Entry file is defined at
https://standards.freedesktop.org/desktop-entry-spec/latest/index.html
- Basically, values with 'localestring' type can be translated.
+ Basically, values with 'localestring' type can be localized.
+ However, the values of 'Icon', while being localizable, are not supported
+ by xgettext. See the documentation for more info.
The type of a value is determined by looking at the key associated
with it. The list of available keys are listed on:
- https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html */
+ https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s04.html */
static hash_table keywords;
static bool default_keywords = true;
msgfmt-15 msgfmt-16 msgfmt-17 msgfmt-18 msgfmt-19 \
msgfmt-properties-1 \
msgfmt-qt-1 msgfmt-qt-2 \
- msgfmt-desktop-1 msgfmt-desktop-2 \
+ msgfmt-desktop-1 msgfmt-desktop-2 msgfmt-desktop-3 \
msgfmt-xml-1 msgfmt-xml-2 \
msggrep-1 msggrep-2 msggrep-3 msggrep-4 msggrep-5 msggrep-6 msggrep-7 \
msggrep-8 msggrep-9 msggrep-10 msggrep-11 \
xgettext-javascript-7 \
xgettext-vala-1 xgettext-vala-2 \
xgettext-gsettings-1 \
- xgettext-desktop-1 \
+ xgettext-desktop-1 xgettext-desktop-2 \
xgettext-its-1 xgettext-its-2 \
format-awk-1 format-awk-2 \
format-boost-1 format-boost-2 \
--- /dev/null
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test of Icon handling in Desktop Entry support.
+
+cat <<\EOF > hello.desktop
+[Desktop Entry]
+Name=Hello
+TryExec=hello
+Exec=hello
+Icon=handshake.jpg
+Icon[en_US]=hifive.jpg
+Icon[th]=wai.jpg
+Type=Application
+Keywords=Utility;
+EOF
+
+cat <<\EOF > th.po
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-08-18 12:45+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: Thai <th@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: hello.desktop:3
+msgid "Hello"
+msgstr "สวัสดี"
+
+#: hello.desktop:10
+msgid "Utility;"
+msgstr "ประโยชน์;"
+EOF
+
+cat <<\EOF > hello.desktop.ok
+[Desktop Entry]
+Name[th]=สวัสดี
+Name=Hello
+TryExec=hello
+Exec=hello
+Icon=handshake.jpg
+Icon[en_US]=hifive.jpg
+Icon[th]=wai.jpg
+Type=Application
+Keywords[th]=ประโยชน์;
+Keywords=Utility;
+EOF
+
+# Generate the merged .desktop file.
+
+${MSGFMT} --desktop --template=hello.desktop -l th th.po -o hello.desktop.tmp \
+ || Exit 1
+LC_ALL=C tr -d '\r' < hello.desktop.tmp > hello.desktop.out || Exit 1
+
+: ${DIFF=diff}
+${DIFF} hello.desktop.ok hello.desktop.out
+result=$?
+
+exit $result
--- /dev/null
+#!/bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test of Icon handling in Desktop Entry support.
+
+: ${XGETTEXT=xgettext}
+
+cat <<\EOF > hello.desktop
+[Desktop Entry]
+Name=Hello
+TryExec=hello
+Exec=hello
+Icon=handshake.jpg
+Icon[en_US]=hifive.jpg
+Icon[th]=wai.jpg
+Type=Application
+Keywords=Utility;
+EOF
+
+${XGETTEXT} --add-comments -o xg-de-2.tmp hello.desktop || Exit 1
+grep -v 'POT-Creation-Date' < xg-de-2.tmp > hello-desktop.pot || Exit 1
+
+cat <<\EOF > hello-desktop.ok
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: hello.desktop:3
+msgid "Hello"
+msgstr ""
+
+#: hello.desktop:10
+msgid "Utility;"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} hello-desktop.ok hello-desktop.pot
+result=$?
+
+exit $result