1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test iterative mode of msgfmt --desktop. 5 6cat <<\EOF > mf.desktop 7[Desktop Entry] 8Type=Application 9Name =Foo 10Comment[foo]=Already translated comment 11Comment= \sThis is a \nmultiline comment; for testing 12Keywords=Keyword1;Keyword2;Key\;word3; 13Categories= 14NoDisplay=true 15EOF 16 17cat <<\EOF > fr.po 18# SOME DESCRIPTIVE TITLE. 19# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 20# This file is distributed under the same license as the PACKAGE package. 21# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 22# 23#, fuzzy 24msgid "" 25msgstr "" 26"Project-Id-Version: PACKAGE VERSION\n" 27"Report-Msgid-Bugs-To: \n" 28"POT-Creation-Date: 2014-03-17 07:36+0900\n" 29"PO-Revision-Date: 2014-03-17 08:40+0900\n" 30"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 31"Language-Team: LANGUAGE <LL@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#: xg.desktop:4 38msgid "Foo" 39msgstr "" 40"French\n" 41"foo" 42 43#: xg.desktop:5 44msgid "" 45" This is a \n" 46"multiline comment; for testing" 47msgstr "" 48"French \n" 49"comment" 50 51#: xg.desktop:7 52msgid "Keyword1;Keyword2;Key\\;word3;" 53msgstr "one;two;thr\\;ee;" 54EOF 55 56cat <<\EOF > mf.desktop.ok 57[Desktop Entry] 58Type=Application 59Name[fr]=French\nfoo 60Name=Foo 61Comment[foo]=Already translated comment 62Comment[fr]=French \ncomment 63Comment=\sThis is a \nmultiline comment; for testing 64Keywords[fr]=one;two;thr\;ee; 65Keywords=Keyword1;Keyword2;Key\;word3; 66Categories= 67NoDisplay=true 68EOF 69 70# Sanity checks for contradicting options. 71 72${MSGFMT} --desktop --template=mf.desktop -l fr fr.po \ 73 >/dev/null 2>/dev/null \ 74 && Exit 1 75 76${MSGFMT} --desktop --template=mf.desktop fr.po -o mf.desktop.out \ 77 >/dev/null 2>/dev/null \ 78 && Exit 1 79 80# Proceed to the .desktop file generation. 81 82${MSGFMT} --desktop --template=mf.desktop -l fr fr.po -o mf.desktop.tmp \ 83 || Exit 1 84LC_ALL=C tr -d '\r' < mf.desktop.tmp > mf.desktop.out || Exit 1 85 86: ${DIFF=diff} 87${DIFF} mf.desktop.ok mf.desktop.out 88result=$? 89 90exit $result 91