Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change default orderBy to message #1519

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions packages/cli/test/extract-po-format/expected/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ msgstr ""
"X-Generator: @lingui/cli\n"
"Language: en\n"

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgstr "Hello this is JSX Translation"

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr "Hello this is JSX Translation"

#. js-lingui-id: 1nGWAC
#: fixtures/file-a.ts:4
msgid "Hello world"
Expand All @@ -18,29 +30,17 @@ msgctxt "custom context"
msgid "Hello world"
msgstr "Hello world"

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr "Hello this is JSX Translation"

#. js-lingui-id: BcXPt3
#: fixtures/file-a.ts:16
msgid "Message in descriptor"
msgstr "Message in descriptor"

#: fixtures/file-a.ts:11
#, explicit-id
msgid "custom.id"
msgstr "This message has custom id"

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgstr "Hello this is JSX Translation"

#: fixtures/file-b.tsx:15
#, explicit-id
msgid "jsx.custom.id"
msgstr "This JSX element has custom id"

#: fixtures/file-a.ts:11
#, explicit-id
msgid "custom.id"
msgstr "This message has custom id"
32 changes: 16 additions & 16 deletions packages/cli/test/extract-po-format/expected/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ msgstr ""
"X-Generator: @lingui/cli\n"
"Language: pl\n"

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: 1nGWAC
#: fixtures/file-a.ts:4
msgid "Hello world"
Expand All @@ -18,29 +30,17 @@ msgctxt "custom context"
msgid "Hello world"
msgstr ""

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: BcXPt3
#: fixtures/file-a.ts:16
msgid "Message in descriptor"
msgstr ""

#: fixtures/file-a.ts:11
#: fixtures/file-b.tsx:15
#, explicit-id
msgid "custom.id"
msgstr ""

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgid "jsx.custom.id"
msgstr ""

#: fixtures/file-b.tsx:15
#: fixtures/file-a.ts:11
#, explicit-id
msgid "jsx.custom.id"
msgid "custom.id"
msgstr ""
32 changes: 16 additions & 16 deletions packages/cli/test/extract-template-po-format/expected/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: 1nGWAC
#: fixtures/file-a.ts:4
msgid "Hello world"
Expand All @@ -17,29 +29,17 @@ msgctxt "custom context"
msgid "Hello world"
msgstr ""

#. js-lingui-id: 6qYmGe
#: fixtures/file-b.tsx:11
msgctxt "my context"
msgid "Hello this is JSX Translation"
msgstr ""

#. js-lingui-id: BcXPt3
#: fixtures/file-a.ts:16
msgid "Message in descriptor"
msgstr ""

#: fixtures/file-a.ts:11
#: fixtures/file-b.tsx:15
#, explicit-id
msgid "custom.id"
msgstr ""

#. this is a comment
#. js-lingui-id: f9Atdk
#: fixtures/file-b.tsx:6
msgid "Hello this is JSX Translation"
msgid "jsx.custom.id"
msgstr ""

#: fixtures/file-b.tsx:15
#: fixtures/file-a.ts:11
#, explicit-id
msgid "jsx.custom.id"
msgid "custom.id"
msgstr ""
2 changes: 1 addition & 1 deletion packages/conf/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`@lingui/conf should return default config 1`] = `
locales: [
en-gb,
],
orderBy: messageId,
orderBy: message,
pseudoLocale: ,
rootDir: .,
runtimeConfigModule: {
Expand Down
2 changes: 1 addition & 1 deletion packages/conf/src/makeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const defaultConfig: LinguiConfig = {
format: "po",
formatOptions: { origins: true, lineNumbers: true },
locales: [],
orderBy: "messageId",
orderBy: "message",
pseudoLocale: "",
rootDir: ".",
runtimeConfigModule: ["@lingui/core", "i18n"],
Expand Down
10 changes: 5 additions & 5 deletions website/docs/ref/conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,18 @@ Locale tags which are used in the project. [`extract`](/docs/ref/cli.md#extract)

## orderBy

Default: `messageId`
Default: `message`

Order of messages in catalog:

#### messageId

Sort by the message ID, `js-lingui-id` will be used if no custom id provided.

#### message

Sort by source message.

#### messageId

Sort by the message ID, `js-lingui-id` will be used if no custom id provided.

#### origin

Sort by message origin (e.g. `App.js:3`)
Expand Down