1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test extractor of Free Pascal .rsj files. 5 6cat <<\EOF > xg-rst-2-oldstyle.pas 7program oldstyle; 8 9resourcestring 10 testcase = 'Böse Bübchen ärgern über die Maßen'; 11 12begin 13end. 14EOF 15 16cat <<\EOF > xg-rst-2-hello.pas 17program hello; 18{$codepage utf8} 19 20resourcestring 21 hello_world = 'Hello, world!'; 22 running_as = 'This program is running as process number %d.'; 23 russian = 'Russian (Русский): Здравствуйте'; 24 vietnamese = 'Vietnamese (Tiếng Việt): Chào bạn'; 25 japanese = 'Japanese (日本語): こんにちは'; 26 thai = 'Thai (ภาษาไทย): สวัสดีครับ'; 27 { fpc 3.0.0 chokes on this: "Error: UTF-8 code greater than 65535 found" } 28 script = ''; 29 30begin 31end. 32EOF 33 34# Result of "iconv -f UTF-8 -t ISO-8859-1 < xg-rst-2-oldstyle.pas > oldstyle.pas ; ppcx64 oldstyle.pas" 35cat <<\EOF > xg-rst-2-oldstyle.rsj 36{"version":1,"strings":[ 37{"hash":197750254,"name":"oldstyle.testcase","sourcebytes":[66,246,115,101,32,66,252,98,99,104,101,110,32,228,114,103,101,114,110,32,252,98,101,114,32,100,105,101,32,77,97,223,101,110],"value":"B\u00F6se B\u00FCbchen \u00E4rgern \u00FCber die Ma\u00DFen"} 38]} 39EOF 40 41# Expected result of "ppcx64 xg-rst-2-hello.pas" 42cat <<\EOF > xg-rst-2-hello.rsj 43{"version":1,"strings":[ 44{"hash":153469889,"name":"hello.hello_world","sourcebytes":[72,101,108,108,111,44,32,119,111,114,108,100,33],"value":"Hello, world!"}, 45{"hash":1323310,"name":"hello.running_as","sourcebytes":[84,104,105,115,32,112,114,111,103,114,97,109,32,105,115,32,114,117,110,110,105,110,103,32,97,115,32,112,114,111,99,101,115,115,32,110,117,109,98,101,114,32,37,100,46],"value":"This program is running as process number %d."}, 46{"hash":8471413,"name":"hello.russian","sourcebytes":[82,117,115,115,105,97,110,32,40,208,160,209,131,209,129,209,129,208,186,208,184,208,185,41,58,32,208,151,208,180,209,128,208,176,208,178,209,129,209,130,208,178,209,131,208,185,209,130,208,181],"value":"Russian (\u0420\u0443\u0441\u0441\u043A\u0438\u0439): \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435"}, 47{"hash":12693150,"name":"hello.vietnamese","sourcebytes":[86,105,101,116,110,97,109,101,115,101,32,40,84,105,225,186,191,110,103,32,86,105,225,187,135,116,41,58,32,67,104,195,160,111,32,98,225,186,161,110],"value":"Vietnamese (Ti\u1EBFng Vi\u1EC7t): Ch\u00E0o b\u1EA1n"}, 48{"hash":48190495,"name":"hello.japanese","sourcebytes":[74,97,112,97,110,101,115,101,32,40,230,151,165,230,156,172,232,170,158,41,58,32,227,129,147,227,130,147,227,129,171,227,129,161,227,129,175],"value":"Japanese (\u65E5\u672C\u8A9E): \u3053\u3093\u306B\u3061\u306F"}, 49{"hash":121047034,"name":"hello.thai","sourcebytes":[84,104,97,105,32,40,224,184,160,224,184,178,224,184,169,224,184,178,224,185,132,224,184,151,224,184,162,41,58,32,224,184,170,224,184,167,224,184,177,224,184,170,224,184,148,224,184,181,224,184,132,224,184,163,224,184,177,224,184,154],"value":"Thai (\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22): \u0E2A\u0E27\u0E31\u0E2A\u0E14\u0E35\u0E04\u0E23\u0E31\u0E1A"}, 50{"hash":123456789,"name":"hello.script","sourcebytes":[240,157,146,158],"value":"\uD835\uDC9E"} 51]} 52EOF 53 54: ${XGETTEXT=xgettext} 55${XGETTEXT} -o xg-rst-2.tmp xg-rst-2-oldstyle.rsj xg-rst-2-hello.rsj || Exit 1 56func_filter_POT_Creation_Date xg-rst-2.tmp xg-rst-2.po 57 58cat <<\EOF > xg-rst-2.ok 59# SOME DESCRIPTIVE TITLE. 60# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 61# This file is distributed under the same license as the PACKAGE package. 62# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 63# 64#, fuzzy 65msgid "" 66msgstr "" 67"Project-Id-Version: PACKAGE VERSION\n" 68"Report-Msgid-Bugs-To: \n" 69"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 70"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 71"Language-Team: LANGUAGE <LL@li.org>\n" 72"Language: \n" 73"MIME-Version: 1.0\n" 74"Content-Type: text/plain; charset=UTF-8\n" 75"Content-Transfer-Encoding: 8bit\n" 76 77#: oldstyle.testcase 78msgid "Böse Bübchen ärgern über die Maßen" 79msgstr "" 80 81#: hello.hello_world 82msgid "Hello, world!" 83msgstr "" 84 85#: hello.running_as 86#, object-pascal-format 87msgid "This program is running as process number %d." 88msgstr "" 89 90#: hello.russian 91msgid "Russian (Русский): Здравствуйте" 92msgstr "" 93 94#: hello.vietnamese 95msgid "Vietnamese (Tiếng Việt): Chào bạn" 96msgstr "" 97 98#: hello.japanese 99msgid "Japanese (日本語): こんにちは" 100msgstr "" 101 102#: hello.thai 103msgid "Thai (ภาษาไทย): สวัสดีครับ" 104msgstr "" 105 106#: hello.script 107msgid "" 108msgstr "" 109EOF 110 111: ${DIFF=diff} 112${DIFF} xg-rst-2.ok xg-rst-2.po 113result=$? 114 115exit $result 116