1#!/bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3# 4# More tests for java support 5# 6 7cat <<\EOF > xg-j-2.java 8class TestCase { 9 public static void main (String[] args) { 10 // Test recognition of \u escapes: B�se B�bchen 11 gettext ("B\u00f6se B\u00fcbchen"); 12 // Test recognition of \u escapes with different number of u 13 gettext ("Japanese: \uu65e5\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu672c\u8A9e"); 14 // Test recognition of \u escapes when they form UTF-16 surrogates 15 // Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C 16 gettext ("script \ud835\udc9e = ..."); 17 // Test invalid surrogates. 18 gettext ("invalid surrogate \ud835 first half"); 19 gettext ("invalid surrogate \udc9e second half"); 20 // Don't let the line numbers be confused by \u newlines. 21 \u000a \u000d \u000d\u000a 22 gettext ("embedded\nnewline"); 23 // Spaces from end of comment are removed. \u000agettext("dummy"); 24 // Various ways to write a backslash are equivalent. 25 gettext ("\u005c\u005c"); 26 gettext ("\u005c\"); 27 gettext ("\\u005c"); 28 gettext ("\\"); 29 gettext ("\134"); 30 // Escape sequences in strings. 31 gettext ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ..."); 32 // Octal escapes have 2 or 3 digits, depending on the initial digit. 33 gettext ("bel: \7\nnewline: \12backslash: \134\ndquote-zero: \420\n"); 34 // Hex escapes are not recognized 35 gettext ("no bel: \x07\n"); 36 gettext // Recognized despite comments 37 ( /* Even across multiline 38comment! */ "this is a single " /* now comes the concatenation! */ + // after + 39 "long line"); 40 // Character literals are not extracted. 41 gettext ('x'); 42 // Invalid concatenations are not concatenated. 43 gettext ("fooba"+'r'); 44 // Verify that the static function name has priority. 45 GettextResource.gettext("NOT extracted", "this one is extracted"); 46 // Verify that a comma inside braces is hidden. 47 GettextResource.gettext( 48 new Object() { 49 public int foo () { 50 return 5, 8; 51 } 52 }, 53 "this is the second argument"); 54 // Text blocks are extracted. 55 gettext (""" 56 a one-liner block """); 57 gettext (""" 58 ibam forte via sacra sicut meus est mos 59 nescio quid meditans nugarum totus in illis 60 61 accurrit quidam notus mihi nomine tantum 62 arreptaque manu "quid agis, dulcissime rerum?" 63 """); 64 gettext (""" 65 \"""a text block in a text block\""" """); 66 gettext (""" 67 testing mixed ASCII and Unicode whitespace 68 \u0020 line 2 69 \u0020line 3 70 \u0020line 4 71 and trailing whitespace 72 as well \u0020 73 also in the last line\u0020""" 74 ); 75 } 76} 77EOF 78 79: ${XGETTEXT=xgettext} 80${XGETTEXT} --from-code=ISO-8859-1 -c -o xg-j-2.tmp xg-j-2.java 2>/dev/null || Exit 1 81func_filter_POT_Creation_Date xg-j-2.tmp xg-j-2.pot 82 83cat <<\EOF > xg-j-2.ok 84# SOME DESCRIPTIVE TITLE. 85# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 86# This file is distributed under the same license as the PACKAGE package. 87# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 88# 89#, fuzzy 90msgid "" 91msgstr "" 92"Project-Id-Version: PACKAGE VERSION\n" 93"Report-Msgid-Bugs-To: \n" 94"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 95"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 96"Language-Team: LANGUAGE <LL@li.org>\n" 97"Language: \n" 98"MIME-Version: 1.0\n" 99"Content-Type: text/plain; charset=UTF-8\n" 100"Content-Transfer-Encoding: 8bit\n" 101 102#. Test recognition of \u escapes: Böse Bübchen 103#: xg-j-2.java:4 104msgid "Böse Bübchen" 105msgstr "" 106 107#. Test recognition of \u escapes with different number of u 108#: xg-j-2.java:6 109msgid "Japanese: 日本語" 110msgstr "" 111 112#. Test recognition of \u escapes when they form UTF-16 surrogates 113#. Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C 114#: xg-j-2.java:9 115msgid "script = ..." 116msgstr "" 117 118#. Test invalid surrogates. 119#: xg-j-2.java:11 120msgid "invalid surrogate � first half" 121msgstr "" 122 123#: xg-j-2.java:12 124msgid "invalid surrogate � second half" 125msgstr "" 126 127#. Don't let the line numbers be confused by \u newlines. 128#: xg-j-2.java:15 129msgid "" 130"embedded\n" 131"newline" 132msgstr "" 133 134#. Spaces from end of comment are removed. 135#: xg-j-2.java:16 136msgid "dummy" 137msgstr "" 138 139#. Various ways to write a backslash are equivalent. 140#: xg-j-2.java:18 xg-j-2.java:19 xg-j-2.java:20 xg-j-2.java:21 xg-j-2.java:22 141msgid "\\" 142msgstr "" 143 144#. Escape sequences in strings. 145#: xg-j-2.java:24 146msgid "" 147"t -> \t, b -> \b, n -> \n" 148", dquote -> \", squote -> ' ..." 149msgstr "" 150 151#. Octal escapes have 2 or 3 digits, depending on the initial digit. 152#: xg-j-2.java:26 153msgid "" 154"bel: \a\n" 155"newline: \n" 156"backslash: \\\n" 157"dquote-zero: \"0\n" 158msgstr "" 159 160#. Hex escapes are not recognized 161#: xg-j-2.java:28 162msgid "no bel: \\x07\n" 163msgstr "" 164 165#. Recognized despite comments 166#. Even across multiline 167#. comment! 168#: xg-j-2.java:31 169msgid "this is a single long line" 170msgstr "" 171 172#. Invalid concatenations are not concatenated. 173#: xg-j-2.java:36 174msgid "fooba" 175msgstr "" 176 177#. Verify that the static function name has priority. 178#: xg-j-2.java:38 179msgid "this one is extracted" 180msgstr "" 181 182#: xg-j-2.java:46 183msgid "this is the second argument" 184msgstr "" 185 186#. Text blocks are extracted. 187#: xg-j-2.java:48 188msgid "a one-liner block" 189msgstr "" 190 191#: xg-j-2.java:50 192msgid "" 193"ibam forte via sacra sicut meus est mos\n" 194"nescio quid meditans nugarum totus in illis\n" 195"\n" 196"accurrit quidam notus mihi nomine tantum\n" 197"arreptaque manu \"quid agis, dulcissime rerum?\"\n" 198msgstr "" 199 200#: xg-j-2.java:57 201msgid "\"\"\"a text block in a text block\"\"\"" 202msgstr "" 203 204#: xg-j-2.java:59 205msgid "" 206"testing mixed ASCII and Unicode whitespace\n" 207"line 2\n" 208"line 3\n" 209" line 4\n" 210"and trailing whitespace\n" 211"as well\n" 212"also in the last line" 213msgstr "" 214EOF 215 216: ${DIFF=diff} 217${DIFF} xg-j-2.ok xg-j-2.pot 218result=$? 219 220exit $result 221