Home | History | Annotate | Line # | Download | only in tests
      1 #!/bin/sh
      2 
      3 # More tests for C# support: UTF-8 encoded source files
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-cs-2.cs"
      9 cat <<\EOF > xg-cs-2.cs
     10 class TestCase {
     11   public static void Main (String[] args) {
     12     Console.WriteLine(GetString("Russian (): "));
     13     Console.WriteLine(GetString("Vietnamese (Ting Vit): Cho bn"));
     14     Console.WriteLine(GetString("Japanese (): "));
     15     Console.WriteLine(GetString("Thai (): "));
     16     Console.WriteLine(GetString("Script: "));
     17     Console.WriteLine(GetString("Russian (\u0420\u0443\u0441\u0441\u043a\u0438\u0439): \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435"));
     18     Console.WriteLine(GetString("Vietnamese (Ti\u1ebfng Vi\u1ec7t): Ch\u00e0o b\u1ea1n"));
     19     Console.WriteLine(GetString("Japanese (\u65e5\u672c\u8a9e): \u3053\u3093\u306b\u3061\u306f"));
     20     Console.WriteLine(GetString("Thai (\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22): \u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35\u0e04\u0e23\u0e31\u0e1a"));
     21     Console.WriteLine(GetString("Script: \U0001d49e"));
     22     // And now a comment with  and  and Unicode escapes: B\u00f6se B\u00fcbchen
     23     Console.WriteLine(GetString("This string has a multilingual comment"));
     24   }
     25 }
     26 EOF
     27 
     28 tmpfiles="$tmpfiles xg-cs-2.po"
     29 : ${XGETTEXT=xgettext}
     30 # delete POT-Creation-Date: line because the date depends on local time.
     31 ${XGETTEXT} --output - --add-location -c --from-code=UTF-8 xg-cs-2.cs \
     32   | sed '/\"POT-Creation-Date:.*/d' > xg-cs-2.po
     33 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     34 
     35 tmpfiles="$tmpfiles xg-cs-2.ok"
     36 cat <<\EOF > xg-cs-2.ok
     37 # SOME DESCRIPTIVE TITLE.
     38 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
     39 # This file is distributed under the same license as the PACKAGE package.
     40 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
     41 #
     42 #, fuzzy
     43 msgid ""
     44 msgstr ""
     45 "Project-Id-Version: PACKAGE VERSION\n"
     46 "Report-Msgid-Bugs-To: \n"
     47 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
     48 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     49 "Language-Team: LANGUAGE <LL (at] li.org>\n"
     50 "MIME-Version: 1.0\n"
     51 "Content-Type: text/plain; charset=UTF-8\n"
     52 "Content-Transfer-Encoding: 8bit\n"
     53 
     54 #: xg-cs-2.cs:3 xg-cs-2.cs:8
     55 msgid "Russian (): "
     56 msgstr ""
     57 
     58 #: xg-cs-2.cs:4 xg-cs-2.cs:9
     59 msgid "Vietnamese (Ting Vit): Cho bn"
     60 msgstr ""
     61 
     62 #: xg-cs-2.cs:5 xg-cs-2.cs:10
     63 msgid "Japanese (): "
     64 msgstr ""
     65 
     66 #: xg-cs-2.cs:6 xg-cs-2.cs:11
     67 msgid "Thai (): "
     68 msgstr ""
     69 
     70 #: xg-cs-2.cs:7 xg-cs-2.cs:12
     71 msgid "Script: "
     72 msgstr ""
     73 
     74 #. And now a comment with  and  and Unicode escapes: B\u00f6se B\u00fcbchen
     75 #: xg-cs-2.cs:14
     76 msgid "This string has a multilingual comment"
     77 msgstr ""
     78 EOF
     79 
     80 : ${DIFF=diff}
     81 ${DIFF} xg-cs-2.ok xg-cs-2.po
     82 result=$?
     83 
     84 rm -fr $tmpfiles
     85 
     86 exit $result
     87