File: xgettext-javascript-6

package info (click to toggle)
gettext 0.23.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 168,104 kB
  • sloc: ansic: 532,579; sh: 68,252; perl: 28,011; makefile: 9,066; lisp: 3,184; yacc: 1,055; java: 615; cs: 589; cpp: 397; objc: 343; sed: 79; tcl: 63; xml: 40; pascal: 11; php: 7; awk: 7
file content (174 lines) | stat: -rwxr-xr-x 4,444 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test of JavaScript JSX support.

cat <<\EOF > xg-js-6.js
class Foo extends React.Component {
    render() {
        return (
            <div className="aClass" />
        );
    }
}
class Bar extends React.Component {
    render() {
        return (
            <div>
                <span className="someClass" />
                { gettext('Expected translation string #0') }
            </div>
        );
    }
}

var x1 = <x1></x1>;
var s1 = _("Expected translation string #1");
var s2 = "foo";
var x2 = <{s2}>foo {s2} bar</{s2}>;
var x3 = <x3 a1="/"><x4>{_("Expected translation string #2")}</x4></x3>;
var x4 = <x5 a2='/'><x{_("Expected translation string #3")}>
</x{_("Expected translation string #3")}></x5>;
var x4 = <![CDATA[
  _("Unexpected translation string #1")
]]>;
var x5 = <!-- - _("Unexpected translation string #2") - -->;
var s6 = _("Expected translation string #4");
var x6 = <? _("Unexpected translation string #3") ?>;
var x7 = <!--- this is a comment --> <foo>
var s7 = "<{x6}>_("Unexpected translation string #4")</{x6}>" +
         "<!-- _("Unexpected translation string #5") --!>" +
         _("Expected translation string #5");
var s8 = _("<x7>Expected translation string #6</x7>");
var x8 = <x8><x9>{_("<x8>{Expected translation string #7}</x8>")}</x9></x8>
var x9 = <x10 attr='{_("Unexpected translation string #6")}'><x11>data</x11></x10>;
var s9 = _("Expected translation string #8");
</foo>;
function foo() {
  return <a>{ 'b' }</a>;
}
var s10 = _("Expected translation string #9");
// Mixing JSX with template literals.
var s11 = 0;
var s12 = (
  <div>
    _("Expected translation string #10");
    {`${ _("Expected translation string #11") }`}
    _("Expected translation string #12");
  </div>
);
var s13 = _("Expected translation string #13");
var s14 = <div className={`${ _("Expected translation string #14") }`} /> ;
var s15 = _("Expected translation string #15");
var s16 = { a: 1, b: <div className={`${ _("Expected translation string #16") }`} /> };
var s17 = _("Expected translation string #17");
var s18 = `begin${ <div> _("Expected translation string #18") </div> }end`;
var s19 = _("Expected translation string #19");
const s20 = () => (
  <Foo
    a1={_("Expected translation string #20")}
    a2={foo && <div>_("Expected translation string #21")</div>}
    a3={_("Expected translation string #22")}
  />
);
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments --no-location -o xg-js-6.tmp xg-js-6.js 2>xg-js-6.err
test $? = 0 || { cat xg-js-6.err; Exit 1; }
func_filter_POT_Creation_Date xg-js-6.tmp xg-js-6.pot

cat <<\EOF > xg-js-6.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Expected translation string #0"
msgstr ""

msgid "Expected translation string #1"
msgstr ""

msgid "Expected translation string #2"
msgstr ""

msgid "Expected translation string #3"
msgstr ""

msgid "Expected translation string #4"
msgstr ""

msgid "Expected translation string #5"
msgstr ""

msgid "<x7>Expected translation string #6</x7>"
msgstr ""

msgid "<x8>{Expected translation string #7}</x8>"
msgstr ""

msgid "Expected translation string #8"
msgstr ""

msgid "Expected translation string #9"
msgstr ""

msgid "Expected translation string #10"
msgstr ""

msgid "Expected translation string #11"
msgstr ""

msgid "Expected translation string #12"
msgstr ""

msgid "Expected translation string #13"
msgstr ""

msgid "Expected translation string #14"
msgstr ""

msgid "Expected translation string #15"
msgstr ""

msgid "Expected translation string #16"
msgstr ""

msgid "Expected translation string #17"
msgstr ""

msgid "Expected translation string #18"
msgstr ""

msgid "Expected translation string #19"
msgstr ""

msgid "Expected translation string #20"
msgstr ""

msgid "Expected translation string #21"
msgstr ""

msgid "Expected translation string #22"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-js-6.ok xg-js-6.pot
result=$?

exit $result