mirror of
https://https.git.savannah.gnu.org/git/gettext.git
synced 2026-01-26 15:39:11 +00:00
* autopull.sh: Check out tree-sitter-typescript. Set TREE_SITTER_TYPESCRIPT_VERSION. * gettext-tools/build-aux/tree-sitter-typescript-portability.diff: New file. * gettext-tools/configure.ac: Set TREE_SITTER_TYPESCRIPT_VERSION. * gettext-tools/Makefile.am (EXTRA_DIST): Add the tree-sitter-typescript source code and patch. * gettext-tools/doc/lang-typescript.texi: New file. * gettext-tools/doc/Makefile.am (gettext_TEXINFOS): Add it. * gettext-tools/doc/gettext.texi (No string concatenation): Mention string concatenation in TypeScript. (List of Programming Languages): Include lang-typescript.texi. * gettext-tools/doc/xgettext.texi: Document the -L TypeScript and -L TSX options. * gettext-tools/src/x-typescript-impl.h: New file. * gettext-tools/src/x-typescript.h: New file. * gettext-tools/src/x-typescript.c: New file. * gettext-tools/src/x-typescriptx.h: New file. * gettext-tools/src/x-typescriptx.c: New file. * gettext-tools/src/xgettext.c: Include x-typescript.h, x-typescriptx.h. (flag_table_typescript, flag_table_typescriptx): New variables. (main): Invoke init_flag_table_typescript, init_flag_table_typescriptx, x_typescript_extract_all, x_typescriptx_extract_all, x_typescript_keyword, x_typescriptx_keyword. (usage): Document the -L TypeScript and -L TSX options. (xgettext_record_flag): Support format_javascript with TypeScript and TSX. (language_to_extractor, extension_to_language): Support TypeScript and TSX. * gettext-tools/src/FILES: Mention x-typescript.h, x-typescript.c, x-typescriptx.h, x-typescriptx.c, x-typescript-impl.h. * gettext-tools/src/Makefile.am (noinst_LIBRARIES): Reference LIBXGETTEXTTS. (noinst_HEADERS): Add x-typescript.h, x-typescriptx.h, x-typescript-impl.h. (LIBXGETTEXTTS): Add libxgettextts3.a, libxgettextts4.a. (libxgettextts3_a_SOURCES, libxgettextts3_a_CPPFLAGS): New variables. (libxgettextts4_a_SOURCES, libxgettextts4_a_CPPFLAGS): New variables. (xgettext_SOURCES): Add x-typescript.c, x-typescriptx.c. * gettext-tools/tests/xgettext-javascript-6: Improve comments. * gettext-tools/tests/xgettext-typescript-1: New file, based on gettext-tools/tests/xgettext-javascript-1. * gettext-tools/tests/xgettext-typescript-2: New file, based on gettext-tools/tests/xgettext-javascript-2. * gettext-tools/tests/xgettext-typescript-3: New file, based on gettext-tools/tests/xgettext-javascript-3. * gettext-tools/tests/xgettext-typescript-4: New file, based on gettext-tools/tests/xgettext-javascript-4. * gettext-tools/tests/xgettext-typescript-5: New file, based on gettext-tools/tests/xgettext-javascript-5. * gettext-tools/tests/xgettext-typescript-6: New file, based on gettext-tools/tests/xgettext-javascript-6. * gettext-tools/tests/xgettext-typescript-7: New file, based on gettext-tools/tests/xgettext-javascript-7. * gettext-tools/tests/Makefile.am (TESTS): Add the new tests. * NEWS: Mention the TypeScript support.
179 lines
4.4 KiB
Bash
Executable File
179 lines
4.4 KiB
Bash
Executable File
#!/bin/sh
|
|
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
|
|
|
|
# Test of JavaScript E4X and 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>
|
|
);
|
|
}
|
|
}
|
|
|
|
// Some E4X tests.
|
|
|
|
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
|