summaryrefslogtreecommitdiff
path: root/packages/pogen/example/proj1
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pogen/example/proj1')
-rw-r--r--packages/pogen/example/proj1/package.json5
-rw-r--r--packages/pogen/example/proj1/src/i18n/test.pot130
-rw-r--r--packages/pogen/example/proj1/src/test.ts67
-rw-r--r--packages/pogen/example/proj1/src/test2.tsx17
-rw-r--r--packages/pogen/example/proj1/tsconfig.json2
5 files changed, 219 insertions, 2 deletions
diff --git a/packages/pogen/example/proj1/package.json b/packages/pogen/example/proj1/package.json
index 954139ecf..97adf0f3a 100644
--- a/packages/pogen/example/proj1/package.json
+++ b/packages/pogen/example/proj1/package.json
@@ -7,5 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
- "license": "ISC"
+ "license": "ISC",
+ "pogen": {
+ "domain": "test"
+ }
}
diff --git a/packages/pogen/example/proj1/src/i18n/test.pot b/packages/pogen/example/proj1/src/i18n/test.pot
new file mode 100644
index 000000000..8bc5ef236
--- /dev/null
+++ b/packages/pogen/example/proj1/src/i18n/test.pot
@@ -0,0 +1,130 @@
+# 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"
+"POT-Creation-Date: 2016-11-23 00:00+0100\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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/test.ts:4
+#, c-format
+msgid "Hello1, World"
+msgstr ""
+
+#: src/test.ts:8
+#, c-format
+msgid "Hello, quoted \"world\""
+msgstr ""
+
+#: src/test.ts:15
+#, c-format
+msgid "Hello5, World"
+msgstr ""
+
+#: src/test.ts:16
+#, c-format
+msgid "Hello6,%1$s World"
+msgstr ""
+
+#. This one has a multi line comment.
+#. It has multiple lines, and a trailing empty line.
+#.
+#: src/test.ts:23
+#, c-format
+msgid "Hello7,%1$s World%2$s"
+msgstr ""
+
+#: src/test.ts:23
+#, c-format
+msgid "one %1$s"
+msgid_plural "many %1$s"
+msgstr[0] ""
+msgstr[1] ""
+
+#: src/test.ts:26
+#, c-format
+msgid "one bla %1$s"
+msgid_plural "many bla %1$s"
+msgstr[0] ""
+msgstr[1] ""
+
+#: src/test.ts:31
+#, c-format
+msgid "I have %1$s apple"
+msgid_plural "I have %1$s apples"
+msgstr[0] ""
+msgstr[1] ""
+
+#: src/test.ts:35
+#, c-format
+msgid "%1$sHello8,%2$s World%3$s"
+msgstr ""
+
+#.
+#. This one has a multi line comment.
+#. It has multiple lines, and a leading empty line.
+#: src/test.ts:42
+#, c-format
+msgid "Hello9,\" '\" World"
+msgstr ""
+
+#: src/test.ts:46
+#, c-format
+msgid ""
+"Hello10\n"
+" ,\" '\" Wo\n"
+" rld"
+msgstr ""
+
+#: src/test.ts:51
+#, c-format
+msgid ""
+"Hello11 this is a long long string\n"
+"it will go over multiple lines and in the pofile\n"
+"it should be wrapped and stuff"
+msgstr ""
+
+#. This is a single line comment
+#: src/test.ts:56
+#, c-format
+msgid ""
+"Hello12 this is a long long string it will go over multiple lines and in the "
+"pofile it should be wrapped and stuff. asdf asdf asdf asdf asdf asdf asdf asdf "
+"adsf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf "
+"asdf"
+msgstr ""
+
+#. First occurrence
+#: src/test.ts:65
+#, c-format
+msgid "This message appears twice"
+msgstr ""
+
+#: src/test2.tsx:1
+#, c-format
+msgid "foo %1$s foo baz"
+msgstr ""
+
+#: src/test2.tsx:5
+#, c-format
+msgid "singular form second line"
+msgid_plural "plural form"
+msgstr[0] ""
+msgstr[1] ""
+
+#: src/test2.tsx:17
+#, c-format
+msgid "\"foo\""
+msgstr ""
+
diff --git a/packages/pogen/example/proj1/src/test.ts b/packages/pogen/example/proj1/src/test.ts
new file mode 100644
index 000000000..2e9b4cbdd
--- /dev/null
+++ b/packages/pogen/example/proj1/src/test.ts
@@ -0,0 +1,67 @@
+declare var i18n: any;
+
+
+console.log(i18n`Hello1, World`);
+console.log(i18n.foo()`Hello2, World`);
+console.log(i18n.foo()`Hello3, World`);
+
+console.log(i18n`Hello, quoted "world"`);
+
+
+/* This is a comment and should be included */
+console.log(i18n().foo()`Hello4, World`);
+
+
+console.log(i18n.foo`Hello5, World`);
+console.log(i18n.foo`Hello6,${123} World`);
+
+/*
+This one has a multi line comment.
+It has multiple lines, and a trailing empty line.
+
+*/
+console.log(/*lol*/i18n.foo`Hello7,${123} World${42}`);
+
+// @ts-expect-error
+i18n.plural(i18n`one ${"foo"}`, i18`many ${"bar"}`);
+
+// @ts-expect-error
+i18n.plural(i18n.foo`one bla ${"foo"}`, i18.foo`many bla ${"bar"}`);
+
+let x = 42;
+
+i18n.plural(i18n`I have ${x} apple`, i18n`I have ${x} apples`);
+
+console.log(i18n`${"foo"}Hello8,${123} World${42}`);
+
+/*
+
+This one has a multi line comment.
+It has multiple lines, and a leading empty line.
+*/
+console.log(i18n`Hello9," '" World`);
+
+// Comments with space in between do not count
+
+console.log(i18n`Hello10
+ ," '" Wo
+ rld`);
+
+
+console.log(i18n`Hello11 this is a long long string
+it will go over multiple lines and in the pofile
+it should be wrapped and stuff`);
+
+// This is a single line comment
+console.log(i18n`Hello12 this is a long long string it will go over multiple lines and in the pofile it should be wrapped and stuff. asdf asdf asdf asdf asdf asdf asdf asdf adsf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf`);
+
+function foo(...args: any[]) {
+}
+
+console.log(foo`Another string, must be excluded`);
+
+
+// First occurrence
+console.log(i18n`This message appears twice`);
+// Second occurrence
+console.log(i18n`This message appears twice`);
diff --git a/packages/pogen/example/proj1/src/test2.tsx b/packages/pogen/example/proj1/src/test2.tsx
new file mode 100644
index 000000000..1c1ab49f2
--- /dev/null
+++ b/packages/pogen/example/proj1/src/test2.tsx
@@ -0,0 +1,17 @@
+let x = <i18n.Translate>foo
+{bar} {" foo "} baz</i18n.Translate>
+
+
+let y = (
+ <i18n.TranslateSwitch>
+ <i18n.TranslateSingular>
+ singular form
+ second line
+ </i18n.TranslateSingular>
+ <i18n.TranslatePlural>
+ plural form
+ </i18n.TranslatePlural>
+ </i18n.TranslateSwitch>
+);
+
+let z = <i18n.Translate>"foo"</i18n.Translate>;
diff --git a/packages/pogen/example/proj1/tsconfig.json b/packages/pogen/example/proj1/tsconfig.json
index 30cb65e1d..36ef053db 100644
--- a/packages/pogen/example/proj1/tsconfig.json
+++ b/packages/pogen/example/proj1/tsconfig.json
@@ -4,7 +4,7 @@
"composite": true,
"declaration": true,
"declarationMap": false,
- "target": "ES6",
+ "target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"sourceMap": true,