• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2. "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4# Test of Desktop Entry support.
5
6: ${XGETTEXT=xgettext}
7
8cat <<\EOF >err1.desktop
9[Desktop Entry]
10This is an invalid line
11Name =Foo
12EOF
13
14(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err1.desktop 2>&1; exit) | grep "missing '=' after" || Exit 1
15
16cat <<\EOF >err2.desktop
17[Desktop Entry
18EOF
19
20(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err2.desktop 2>&1; exit) | grep "unterminated group name" || Exit 1
21
22cat <<\EOF >err3.desktop
23[Desktop Entry]
24  Not a blank line!
25EOF
26
27(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err3.desktop 2>&1; exit) | grep "invalid non-blank line" || Exit 1
28
29cat <<\EOF >err4.desktop
30[Desktop Entry]a
31EOF
32
33(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - err4.desktop 2>&1; exit) | grep "invalid non-blank character" || Exit 1
34
35# gettext 0.19.4 issued an baseless warning of this.
36cat <<\EOF >ok4.desktop
37[Desktop Entry]
38EOF
39
40(LANGUAGE= LC_ALL=C ${XGETTEXT} --add-comments -o - ok4.desktop 2>&1; exit) | grep "invalid non-blank character" && Exit 1
41
42cat <<\EOF > xg.desktop
43[Desktop Entry]
44Type=Application
45Name =Foo
46# This is a comment for comment
47#   This is a comment for comment
48Comment= \sThis is a \nmultiline\t comment; for testing
49Comment[foo]=Already translated comment
50X-Foo = bar
51# This is a comment before a blank line
52
53Keywords=Keyword1;Keyword2;Key\;word3;
54EOF
55
56${XGETTEXT} --add-comments -o xg-de-1.tmp xg.desktop || Exit 1
57func_filter_POT_Creation_Date xg-de-1.tmp xg-desktop.pot
58
59cat <<\EOF > xg-desktop.ok
60# SOME DESCRIPTIVE TITLE.
61# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
62# This file is distributed under the same license as the PACKAGE package.
63# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
64#
65#, fuzzy
66msgid ""
67msgstr ""
68"Project-Id-Version: PACKAGE VERSION\n"
69"Report-Msgid-Bugs-To: \n"
70"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
71"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
72"Language-Team: LANGUAGE <LL@li.org>\n"
73"Language: \n"
74"MIME-Version: 1.0\n"
75"Content-Type: text/plain; charset=CHARSET\n"
76"Content-Transfer-Encoding: 8bit\n"
77
78#: xg.desktop:4
79msgid "Foo"
80msgstr ""
81
82#. This is a comment for comment
83#. This is a comment for comment
84#: xg.desktop:7
85msgid ""
86" This is a \n"
87"multiline\t comment; for testing"
88msgstr ""
89
90#: xg.desktop:12
91msgid "Keyword1;Keyword2;Key\\;word3;"
92msgstr ""
93EOF
94
95: ${DIFF=diff}
96${DIFF} xg-desktop.ok xg-desktop.pot
97result=$?
98
99exit $result
100