1#! /bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test of Icon handling in Desktop Entry support.
5
6cat <<\EOF > hello.desktop
7[Desktop Entry]
8Name=Hello
9TryExec=hello
10Exec=hello
11Icon=handshake.jpg
12Icon[en_US]=hifive.jpg
13Icon[th]=wai.jpg
14Type=Application
15Keywords=Utility;
16EOF
17
18cat <<\EOF > th.po
19# SOME DESCRIPTIVE TITLE.
20# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
21# This file is distributed under the same license as the PACKAGE package.
22# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
23#
24msgid ""
25msgstr ""
26"Project-Id-Version: PACKAGE VERSION\n"
27"Report-Msgid-Bugs-To: \n"
28"POT-Creation-Date: 2019-08-18 12:45+0200\n"
29"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
30"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
31"Language-Team: Thai <th@li.org>\n"
32"Language: \n"
33"MIME-Version: 1.0\n"
34"Content-Type: text/plain; charset=UTF-8\n"
35"Content-Transfer-Encoding: 8bit\n"
36
37#: hello.desktop:3
38msgid "Hello"
39msgstr "สวัสดี"
40
41#: hello.desktop:10
42msgid "Utility;"
43msgstr "ประโยชน์;"
44EOF
45
46cat <<\EOF > hello.desktop.ok
47[Desktop Entry]
48Name[th]=สวัสดี
49Name=Hello
50TryExec=hello
51Exec=hello
52Icon=handshake.jpg
53Icon[en_US]=hifive.jpg
54Icon[th]=wai.jpg
55Type=Application
56Keywords[th]=ประโยชน์;
57Keywords=Utility;
58EOF
59
60# Generate the merged .desktop file.
61
62${MSGFMT} --desktop --template=hello.desktop -l th th.po -o hello.desktop.tmp \
63  || Exit 1
64LC_ALL=C tr -d '\r' < hello.desktop.tmp > hello.desktop.out || Exit 1
65
66: ${DIFF=diff}
67${DIFF} hello.desktop.ok hello.desktop.out
68result=$?
69
70exit $result
71