-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cli): check for consistent results with partial extracts
- Loading branch information
1 parent
6d02e73
commit 2317d95
Showing
5 changed files
with
179 additions
and
1 deletion.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
packages/cli/test/extract-partial-consistency/existing/en.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
msgid "" | ||
msgstr "" | ||
"POT-Creation-Date: 2023-03-15 10:00+0000\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"X-Generator: @lingui/cli\n" | ||
"Language: en\n" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-a.ts:11 | ||
#~ msgid "custom.id" | ||
#~ msgstr "This message has custom id" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-a.ts:22 | ||
#: fixtures/file-a.ts:23 | ||
msgid "addToCart" | ||
msgstr "Add To Cart with change ignored" | ||
|
||
#. this is a comment | ||
#: fixtures/file-b.tsx:6 | ||
msgid "Hello this is JSX Translation" | ||
msgstr "Hello this is JSX Translation" | ||
|
||
#: fixtures/file-b.tsx:11 | ||
msgctxt "my context" | ||
msgid "Hello this is JSX Translation" | ||
msgstr "Hello this is JSX Translation" | ||
|
||
#: fixtures/file-a.ts:4 | ||
msgid "Hello world" | ||
msgstr "Hello world" | ||
|
||
#: fixtures/file-a.ts:6 | ||
msgctxt "custom context" | ||
msgid "Hello world" | ||
msgstr "Hello world" | ||
|
||
#: fixtures/file-a.ts:16 | ||
msgid "Message in descriptor" | ||
msgstr "Message in descriptor" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-b.tsx:15 | ||
msgid "jsx.custom.id" | ||
msgstr "This JSX element has custom id" |
53 changes: 53 additions & 0 deletions
53
packages/cli/test/extract-partial-consistency/expected/en.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
msgid "" | ||
msgstr "" | ||
"POT-Creation-Date: 2023-03-15 10:00+0000\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"X-Generator: @lingui/cli\n" | ||
"Language: en\n" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-a.ts:11 | ||
#~ msgid "custom.id" | ||
#~ msgstr "This message has custom id" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-a.ts:22 | ||
#: fixtures/file-a.ts:23 | ||
msgid "addToCart" | ||
msgstr "Add To Cart with change ignored" | ||
|
||
#. this is a comment | ||
#: fixtures/file-b.tsx:6 | ||
msgid "Hello this is JSX Translation" | ||
msgstr "Hello this is JSX Translation" | ||
|
||
#: fixtures/file-b.tsx:11 | ||
msgctxt "my context" | ||
msgid "Hello this is JSX Translation" | ||
msgstr "Hello this is JSX Translation" | ||
|
||
#: fixtures/file-a.ts:4 | ||
msgid "Hello world" | ||
msgstr "Hello world" | ||
|
||
#: fixtures/file-a.ts:6 | ||
msgctxt "custom context" | ||
msgid "Hello world" | ||
msgstr "Hello world" | ||
|
||
#: fixtures/file-a.ts:16 | ||
msgid "Message in descriptor" | ||
msgstr "Message in descriptor" | ||
|
||
#. js-lingui-explicit-id | ||
#: fixtures/file-b.tsx:15 | ||
msgid "jsx.custom.id" | ||
msgstr "This JSX element has custom id" |
23 changes: 23 additions & 0 deletions
23
packages/cli/test/extract-partial-consistency/fixtures/file-a.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { i18n } from "@lingui/core" | ||
import { defineMessage, t } from "@lingui/macro" | ||
|
||
const msg = t`Hello world` | ||
|
||
const msg2 = t({ | ||
message: "Hello world", | ||
context: "custom context", | ||
}) | ||
|
||
const msg3 = null /* original translation commented to mark message obsolete *//*t({ | ||
message: "This message has custom id", | ||
id: "custom.id", | ||
})*/ | ||
|
||
const msgDescriptor = defineMessage({ | ||
message: "Message in descriptor", | ||
}) | ||
|
||
i18n._(msgDescriptor) | ||
|
||
i18n._("addToCart") | ||
i18n._({id: "addToCart", message: "Add To Cart with change ignored"}) |
16 changes: 16 additions & 0 deletions
16
packages/cli/test/extract-partial-consistency/fixtures/file-b.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Trans } from "@lingui/macro" | ||
import React from "react" | ||
|
||
export function MyComponent() { | ||
return ( | ||
<Trans comment={"this is a comment"}>Hello this is JSX Translation</Trans> | ||
) | ||
} | ||
|
||
export function MyComponent2() { | ||
return <Trans context="my context">Hello this is JSX Translation</Trans> | ||
} | ||
|
||
export function MyComponent3() { | ||
return <Trans id={"jsx.custom.id"}>This JSX element has custom id</Trans> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters