Hello World!
@@ -308,7 +308,7 @@ const cases: TestCase[] = [
name: "Elements inside expression container",
stripId: true,
input: `
- import { Trans } from '@lingui/react.macro';
+ import { Trans } from '@lingui/react/macro';
{Component inside expression container};
`,
expected: `
@@ -326,7 +326,7 @@ const cases: TestCase[] = [
name: "Elements without children",
stripId: true,
input: `
- import { Trans } from '@lingui/react.macro';
+ import { Trans } from '@lingui/react/macro';
{
};
`,
expected: `
@@ -340,7 +340,7 @@ const cases: TestCase[] = [
name: "Production - only essential props are kept",
production: true,
input: `
- import { Trans } from '@lingui/react.macro';
+ import { Trans } from '@lingui/react/macro';
Hello World
`,
expected: `
@@ -355,7 +355,7 @@ const cases: TestCase[] = [
extract: true,
},
input: `
- import { Trans } from '@lingui/react.macro';
+ import { Trans } from '@lingui/react/macro';
Hello World
`,
expected: `
@@ -369,7 +369,7 @@ const cases: TestCase[] = [
useTypescriptPreset: true,
input: `
import type { withI18nProps } from '@lingui/react'
- import { Trans } from '@lingui/react.macro';
+ import { Trans } from '@lingui/react/macro';
Hello World
`,
expected: `
@@ -381,7 +381,7 @@ const cases: TestCase[] = [
name: "Strip whitespace around arguments",
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
Strip whitespace around arguments: '
{name}
@@ -399,7 +399,7 @@ const cases: TestCase[] = [
name: "Strip whitespace around tags but keep forced spaces",
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
Strip whitespace around tags, but keep{" "}
forced spaces
@@ -417,7 +417,7 @@ const cases: TestCase[] = [
name: "Keep forced newlines",
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
Keep forced{"\\n"}
newlines!
@@ -432,7 +432,7 @@ const cases: TestCase[] = [
name: "Keep multiple forced newlines",
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
Keep multiple{"\\n"}
forced{"\\n"}
@@ -448,8 +448,8 @@ const cases: TestCase[] = [
name: "Use a js macro inside a JSX Attribute of a component handled by JSX macro",
stripId: true,
input: `
- import { Trans } from '@lingui/react.macro';
- import { t } from '@lingui/macro';
+ import { Trans } from '@lingui/react/macro';
+ import { t } from '@lingui/core/macro';
Read more
`,
expected: `
@@ -482,7 +482,7 @@ const cases: TestCase[] = [
{
name: "Use a js macro inside a JSX Attribute of a non macro JSX component",
input: `
- import { plural } from '@lingui/macro';
+ import { plural } from '@lingui/core/macro';
Hello {/* and I cannot stress this enough */} World;
`,
expected: `
@@ -523,7 +523,7 @@ const cases: TestCase[] = [
name: "Use decoded html entities",
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
&
`,
expected: `
@@ -536,7 +536,7 @@ const cases: TestCase[] = [
useTypescriptPreset: true,
stripId: true,
input: `
- import { Trans } from "@lingui/react.macro";
+ import { Trans } from "@lingui/react/macro";
type X = typeof Trans;
const cmp = Hello
`,
diff --git a/packages/cli/src/api/fixtures/collect-inline-sourcemaps/componentB.jsx b/packages/cli/src/api/fixtures/collect-inline-sourcemaps/componentB.jsx
index 23844c4a1..13bcc2584 100644
--- a/packages/cli/src/api/fixtures/collect-inline-sourcemaps/componentB.jsx
+++ b/packages/cli/src/api/fixtures/collect-inline-sourcemaps/componentB.jsx
@@ -1,3 +1,3 @@
-import { Trans } from "@lingui/react.macro"
+import { Trans } from "@lingui/react/macro"
;Some message
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQuanN4Iiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxlQUFlLENBQUE7QUFJckMsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxZQUFZLEVBQUUsS0FBSyxDQUFDLENBQUEifQ==
diff --git a/packages/cli/src/api/fixtures/collect-typescript-jsx/macro.tsx b/packages/cli/src/api/fixtures/collect-typescript-jsx/macro.tsx
index 8970048fe..1f9580a70 100644
--- a/packages/cli/src/api/fixtures/collect-typescript-jsx/macro.tsx
+++ b/packages/cli/src/api/fixtures/collect-typescript-jsx/macro.tsx
@@ -1,5 +1,5 @@
-import { t, defineMessage, plural } from "@lingui/macro"
-import { Trans } from "@lingui/react.macro"
+import { t, defineMessage, plural } from "@lingui/core/macro"
+import { Trans } from "@lingui/react/macro"
// JS Macro usages
const msg = t`Message`
diff --git a/packages/cli/src/api/fixtures/collect-typescript-jsx/tsx-experimental-decorators.tsx b/packages/cli/src/api/fixtures/collect-typescript-jsx/tsx-experimental-decorators.tsx
index 7e2ca4de5..a34ea030f 100644
--- a/packages/cli/src/api/fixtures/collect-typescript-jsx/tsx-experimental-decorators.tsx
+++ b/packages/cli/src/api/fixtures/collect-typescript-jsx/tsx-experimental-decorators.tsx
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
@Decorator()
export class TestDecorator {
diff --git a/packages/cli/test/extract-po-format/fixtures/file-a.ts b/packages/cli/test/extract-po-format/fixtures/file-a.ts
index 995dc7284..6e305a82a 100644
--- a/packages/cli/test/extract-po-format/fixtures/file-a.ts
+++ b/packages/cli/test/extract-po-format/fixtures/file-a.ts
@@ -1,4 +1,4 @@
-import { defineMessage, t } from "@lingui/macro"
+import { defineMessage, t } from "@lingui/core/macro"
import { i18n } from "@lingui/core"
const msg = t`Hello world`
diff --git a/packages/cli/test/extract-po-format/fixtures/file-b.tsx b/packages/cli/test/extract-po-format/fixtures/file-b.tsx
index a70bd4f7f..3bb619e3d 100644
--- a/packages/cli/test/extract-po-format/fixtures/file-b.tsx
+++ b/packages/cli/test/extract-po-format/fixtures/file-b.tsx
@@ -1,4 +1,4 @@
-import { Trans } from "@lingui/react.macro"
+import { Trans } from "@lingui/react/macro"
import React from "react"
export function MyComponent() {
diff --git a/packages/cli/test/extract-template-po-format/fixtures/file-a.ts b/packages/cli/test/extract-template-po-format/fixtures/file-a.ts
index 995dc7284..6e305a82a 100644
--- a/packages/cli/test/extract-template-po-format/fixtures/file-a.ts
+++ b/packages/cli/test/extract-template-po-format/fixtures/file-a.ts
@@ -1,4 +1,4 @@
-import { defineMessage, t } from "@lingui/macro"
+import { defineMessage, t } from "@lingui/core/macro"
import { i18n } from "@lingui/core"
const msg = t`Hello world`
diff --git a/packages/cli/test/extract-template-po-format/fixtures/file-b.tsx b/packages/cli/test/extract-template-po-format/fixtures/file-b.tsx
index a70bd4f7f..3bb619e3d 100644
--- a/packages/cli/test/extract-template-po-format/fixtures/file-b.tsx
+++ b/packages/cli/test/extract-template-po-format/fixtures/file-b.tsx
@@ -1,4 +1,4 @@
-import { Trans } from "@lingui/react.macro"
+import { Trans } from "@lingui/react/macro"
import React from "react"
export function MyComponent() {
diff --git a/packages/cli/test/extractor-experimental-clean/fixtures/components/header.ts b/packages/cli/test/extractor-experimental-clean/fixtures/components/header.ts
index 4fb7c2973..1a18d198a 100644
--- a/packages/cli/test/extractor-experimental-clean/fixtures/components/header.ts
+++ b/packages/cli/test/extractor-experimental-clean/fixtures/components/header.ts
@@ -1,3 +1,3 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export const msg = t`header message`
diff --git a/packages/cli/test/extractor-experimental-clean/fixtures/pages/about.page.ts b/packages/cli/test/extractor-experimental-clean/fixtures/pages/about.page.ts
index 5859178db..51d7d2db0 100644
--- a/packages/cli/test/extractor-experimental-clean/fixtures/pages/about.page.ts
+++ b/packages/cli/test/extractor-experimental-clean/fixtures/pages/about.page.ts
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
import { msg as headerMsg } from "../components/header"
const msg = t`about page message`
diff --git a/packages/cli/test/extractor-experimental-clean/fixtures/pages/index.page.ts b/packages/cli/test/extractor-experimental-clean/fixtures/pages/index.page.ts
index c4b70e63e..223a82385 100644
--- a/packages/cli/test/extractor-experimental-clean/fixtures/pages/index.page.ts
+++ b/packages/cli/test/extractor-experimental-clean/fixtures/pages/index.page.ts
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
const msg = t`index page message`
console.log(msg)
diff --git a/packages/cli/test/extractor-experimental-clean/package.json b/packages/cli/test/extractor-experimental-clean/package.json
index b612e1c47..b4e8874a8 100644
--- a/packages/cli/test/extractor-experimental-clean/package.json
+++ b/packages/cli/test/extractor-experimental-clean/package.json
@@ -3,7 +3,6 @@
"version": "1.0.0",
"private": true,
"dependencies": {
- "@lingui/macro": "*",
- "@lingui/react.macro": "*"
+ "@lingui/core": "*"
}
}
diff --git a/packages/cli/test/extractor-experimental-template/fixtures/components/aliased-module.ts b/packages/cli/test/extractor-experimental-template/fixtures/components/aliased-module.ts
index 7165a91c0..df60238e5 100644
--- a/packages/cli/test/extractor-experimental-template/fixtures/components/aliased-module.ts
+++ b/packages/cli/test/extractor-experimental-template/fixtures/components/aliased-module.ts
@@ -1,3 +1,3 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export const msg = t`aliased module message`
diff --git a/packages/cli/test/extractor-experimental-template/fixtures/components/header.ts b/packages/cli/test/extractor-experimental-template/fixtures/components/header.ts
index 4fb7c2973..1a18d198a 100644
--- a/packages/cli/test/extractor-experimental-template/fixtures/components/header.ts
+++ b/packages/cli/test/extractor-experimental-template/fixtures/components/header.ts
@@ -1,3 +1,3 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export const msg = t`header message`
diff --git a/packages/cli/test/extractor-experimental-template/fixtures/pages/about.page.tsx b/packages/cli/test/extractor-experimental-template/fixtures/pages/about.page.tsx
index ae0e99b9c..72630c149 100644
--- a/packages/cli/test/extractor-experimental-template/fixtures/pages/about.page.tsx
+++ b/packages/cli/test/extractor-experimental-template/fixtures/pages/about.page.tsx
@@ -1,5 +1,5 @@
-import { t } from "@lingui/macro"
-import { Trans } from "@lingui/react.macro"
+import { t } from "@lingui/core/macro"
+import { Trans } from "@lingui/react/macro"
import { msg as headerMsg } from "../components/header"
// this import should be externalized
diff --git a/packages/cli/test/extractor-experimental-template/fixtures/pages/index.page.ts b/packages/cli/test/extractor-experimental-template/fixtures/pages/index.page.ts
index c4b70e63e..223a82385 100644
--- a/packages/cli/test/extractor-experimental-template/fixtures/pages/index.page.ts
+++ b/packages/cli/test/extractor-experimental-template/fixtures/pages/index.page.ts
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
const msg = t`index page message`
console.log(msg)
diff --git a/packages/cli/test/extractor-experimental-template/package.json b/packages/cli/test/extractor-experimental-template/package.json
index 5616e264f..2d42dc40f 100644
--- a/packages/cli/test/extractor-experimental-template/package.json
+++ b/packages/cli/test/extractor-experimental-template/package.json
@@ -3,8 +3,8 @@
"version": "1.0.0",
"private": true,
"dependencies": {
- "@lingui/macro": "*",
- "@lingui/react.macro": "*",
+ "@lingui/core": "*",
+ "@lingui/react": "*",
"some-package": "*"
}
}
diff --git a/packages/cli/test/extractor-experimental/fixtures/components/header.ts b/packages/cli/test/extractor-experimental/fixtures/components/header.ts
index 4fb7c2973..1a18d198a 100644
--- a/packages/cli/test/extractor-experimental/fixtures/components/header.ts
+++ b/packages/cli/test/extractor-experimental/fixtures/components/header.ts
@@ -1,3 +1,3 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export const msg = t`header message`
diff --git a/packages/cli/test/extractor-experimental/fixtures/pages/about.page.ts b/packages/cli/test/extractor-experimental/fixtures/pages/about.page.ts
index 5859178db..51d7d2db0 100644
--- a/packages/cli/test/extractor-experimental/fixtures/pages/about.page.ts
+++ b/packages/cli/test/extractor-experimental/fixtures/pages/about.page.ts
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
import { msg as headerMsg } from "../components/header"
const msg = t`about page message`
diff --git a/packages/cli/test/extractor-experimental/fixtures/pages/index.page.ts b/packages/cli/test/extractor-experimental/fixtures/pages/index.page.ts
index c4b70e63e..223a82385 100644
--- a/packages/cli/test/extractor-experimental/fixtures/pages/index.page.ts
+++ b/packages/cli/test/extractor-experimental/fixtures/pages/index.page.ts
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
const msg = t`index page message`
console.log(msg)
diff --git a/packages/cli/test/extractor-experimental/package.json b/packages/cli/test/extractor-experimental/package.json
index 4a4c8cc6d..ee4fc4d6c 100644
--- a/packages/cli/test/extractor-experimental/package.json
+++ b/packages/cli/test/extractor-experimental/package.json
@@ -3,6 +3,6 @@
"version": "1.0.0",
"private": true,
"dependencies": {
- "@lingui/macro": "*"
+ "@lingui/core": "*"
}
}
diff --git a/packages/macro/__typetests__/index.test-d.tsx b/packages/core/macro/__typetests__/index.test-d.tsx
similarity index 97%
rename from packages/macro/__typetests__/index.test-d.tsx
rename to packages/core/macro/__typetests__/index.test-d.tsx
index 7ff528e2c..127d6a46c 100644
--- a/packages/macro/__typetests__/index.test-d.tsx
+++ b/packages/core/macro/__typetests__/index.test-d.tsx
@@ -1,7 +1,14 @@
import { expectType } from "tsd"
import type { MessageDescriptor, I18n } from "@lingui/core"
-import { t, defineMessage, msg, plural, selectOrdinal, select } from "../index"
+import {
+ t,
+ defineMessage,
+ msg,
+ plural,
+ selectOrdinal,
+ select,
+} from "@lingui/core/macro"
const name = "Jack"
const i18n: I18n = null
diff --git a/packages/macro/__typetests__/tsconfig.json b/packages/core/macro/__typetests__/tsconfig.json
similarity index 100%
rename from packages/macro/__typetests__/tsconfig.json
rename to packages/core/macro/__typetests__/tsconfig.json
diff --git a/packages/core/macro/index.d.ts b/packages/core/macro/index.d.ts
new file mode 100644
index 000000000..17deeca28
--- /dev/null
+++ b/packages/core/macro/index.d.ts
@@ -0,0 +1,214 @@
+import type { I18n, MessageDescriptor } from "@lingui/core"
+
+export type ChoiceOptions = {
+ /** Offset of value when calculating plural forms */
+ offset?: number
+ zero?: string
+ one?: string
+ two?: string
+ few?: string
+ many?: string
+
+ /** Catch-all option */
+ other: string
+ /** Exact match form, corresponds to =N rule */
+ [digit: `${number}`]: string
+}
+
+type MacroMessageDescriptor = (
+ | {
+ id: string
+ message?: string
+ }
+ | {
+ id?: string
+ message: string
+ }
+) & {
+ comment?: string
+ context?: string
+}
+
+/**
+ * Translates a message descriptor
+ *
+ * @example
+ * ```
+ * import { t } from "@lingui/core/macro";
+ * const message = t({
+ * id: "msg.hello",
+ * comment: "Greetings at the homepage",
+ * message: `Hello ${name}`,
+ * });
+ * ```
+ *
+ * @example
+ * ```
+ * import { t } from "@lingui/core/macro";
+ * const message = t({
+ * id: "msg.plural",
+ * message: plural(value, { one: "...", other: "..." }),
+ * });
+ * ```
+ *
+ * @param descriptor The message descriptor to translate
+ */
+export function t(descriptor: MacroMessageDescriptor): string
+
+/**
+ * Translates a template string using the global I18n instance
+ *
+ * @example
+ * ```
+ * import { t } from "@lingui/core/macro";
+ * const message = t`Hello ${name}`;
+ * ```
+ */
+export function t(
+ literals: TemplateStringsArray,
+ ...placeholders: any[]
+): string
+
+/**
+ * Translates a template string or message descriptor using a given I18n instance
+ *
+ * @example
+ * ```
+ * import { t } from "@lingui/core/macro";
+ * import { I18n } from "@lingui/core";
+ * const i18n = new I18n({
+ * locale: "nl",
+ * messages: { "Hello {0}": "Hallo {0}" },
+ * });
+ * const message = t(i18n)`Hello ${name}`;
+ * ```
+ *
+ * @example
+ * ```
+ * import { t } from "@lingui/core/macro";
+ * import { I18n } from "@lingui/core";
+ * const i18n = new I18n({
+ * locale: "nl",
+ * messages: { "Hello {0}": "Hallo {0}" },
+ * });
+ * const message = t(i18n)({ message: `Hello ${name}` });
+ * ```
+ */
+export function t(i18n: I18n): {
+ (literals: TemplateStringsArray, ...placeholders: any[]): string
+ (descriptor: MacroMessageDescriptor): string
+}
+
+/**
+ * Pluralize a message
+ *
+ * @example
+ * ```
+ * import { plural } from "@lingui/core/macro";
+ * const message = plural(count, {
+ * one: "# Book",
+ * other: "# Books",
+ * });
+ * ```
+ *
+ * @param value Determines the plural form
+ * @param options Object with available plural forms
+ */
+export function plural(value: number | string, options: ChoiceOptions): string
+
+/**
+ * Pluralize a message using ordinal forms
+ *
+ * Similar to `plural` but instead of using cardinal plural forms,
+ * it uses ordinal forms.
+ *
+ * @example
+ * ```
+ * import { selectOrdinal } from "@lingui/core/macro";
+ * const message = selectOrdinal(count, {
+ * one: "#st",
+ * two: "#nd",
+ * few: "#rd",
+ * other: "#th",
+ * });
+ * ```
+ *
+ * @param value Determines the plural form
+ * @param options Object with available plural forms
+ */
+export function selectOrdinal(
+ value: number | string,
+ options: ChoiceOptions
+): string
+
+type SelectOptions = {
+ /** Catch-all option */
+ other: string
+ [matches: string]: string
+}
+
+/**
+ * Selects a translation based on a value
+ *
+ * Select works like a switch statement. It will
+ * select one of the forms in `options` object which
+ * key matches exactly `value`.
+ *
+ * @example
+ * ```
+ * import { select } from "@lingui/core/macro";
+ * const message = select(gender, {
+ * male: "he",
+ * female: "she",
+ * other: "they",
+ * });
+ * ```
+ *
+ * @param value The key of choices to use
+ * @param choices
+ */
+export function select(value: string, choices: SelectOptions): string
+
+/**
+ * Define a message for later use
+ *
+ * `defineMessage` can be used to add comments for translators,
+ * or to override the message ID.
+ *
+ * @example
+ * ```
+ * import { defineMessage } from "@lingui/core/macro";
+ * const message = defineMessage({
+ * comment: "Greetings on the welcome page",
+ * message: `Welcome, ${name}!`,
+ * });
+ * ```
+ *
+ * @param descriptor The message descriptor
+ */
+export function defineMessage(
+ descriptor: MacroMessageDescriptor
+): MessageDescriptor
+
+/**
+ * Define a message for later use
+ *
+ * @example
+ * ```
+ * import { defineMessage, msg } from "@lingui/core/macro";
+ * const message = defineMessage`Hello ${name}`;
+ *
+ * // or using shorter version
+ * const message = msg`Hello ${name}`;
+ * ```
+ */
+export function defineMessage(
+ literals: TemplateStringsArray,
+ ...placeholders: any[]
+): MessageDescriptor
+
+/**
+ * Define a message for later use
+ * Alias for {@see defineMessage}
+ */
+export const msg: typeof defineMessage
diff --git a/packages/core/macro/index.js b/packages/core/macro/index.js
new file mode 100644
index 000000000..fad7573b3
--- /dev/null
+++ b/packages/core/macro/index.js
@@ -0,0 +1 @@
+module.exports = require("@lingui/babel-plugin-lingui-macro/macro")
diff --git a/packages/macro/src/index.test.ts b/packages/core/macro/index.test.ts
similarity index 77%
rename from packages/macro/src/index.test.ts
rename to packages/core/macro/index.test.ts
index 8cc407a1e..d0f728d4f 100644
--- a/packages/macro/src/index.test.ts
+++ b/packages/core/macro/index.test.ts
@@ -1,4 +1,4 @@
-import macro from "@lingui/macro"
+import macro from "@lingui/core/macro"
describe("react-macro", () => {
it("Should re-export Macro", () => {
diff --git a/packages/core/package.json b/packages/core/package.json
index 9c624cf9d..de7c88939 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -45,12 +45,20 @@
"default": "./dist/index.mjs"
}
},
+ "./macro": {
+ "require": {
+ "types": "./macro/index.d.ts",
+ "default": "./macro/index.js"
+ }
+ },
"./package.json": "./package.json"
},
"files": [
"LICENSE",
"README.md",
- "dist/"
+ "dist/",
+ "macro/index.d.ts",
+ "macro/index.js"
],
"dependencies": {
"@babel/runtime": "^7.20.13",
@@ -60,5 +68,17 @@
"devDependencies": {
"@lingui/jest-mocks": "*",
"unbuild": "2.0.0"
+ },
+ "peerDependencies": {
+ "@lingui/babel-plugin-lingui-macro": "4.8.0-next.1",
+ "babel-plugin-macros": "2 || 3"
+ },
+ "peerDependenciesMeta": {
+ "@lingui/babel-plugin-lingui-macro": {
+ "optional": true
+ },
+ "babel-plugin-macros": {
+ "optional": true
+ }
}
}
diff --git a/packages/macro/README.md b/packages/macro/README.md
index 8dfd2e450..872810319 100644
--- a/packages/macro/README.md
+++ b/packages/macro/README.md
@@ -24,7 +24,7 @@ See the [reference][reference] documentation.
```jsx
import { setupI18n } from "@lingui/core"
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
const i18n = setupI18n()
diff --git a/packages/macro/build.config.ts b/packages/macro/build.config.ts
deleted file mode 100644
index ab91d5fa3..000000000
--- a/packages/macro/build.config.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { defineBuildConfig } from "unbuild"
-
-export default defineBuildConfig({
- declaration: false,
-})
diff --git a/packages/macro/index.d.ts b/packages/macro/index.d.ts
index 6d104b133..510eade7b 100644
--- a/packages/macro/index.d.ts
+++ b/packages/macro/index.d.ts
@@ -1,214 +1,8 @@
-import type { I18n, MessageDescriptor } from "@lingui/core"
-
-export type ChoiceOptions = {
- /** Offset of value when calculating plural forms */
- offset?: number
- zero?: string
- one?: string
- two?: string
- few?: string
- many?: string
-
- /** Catch-all option */
- other: string
- /** Exact match form, corresponds to =N rule */
- [digit: `${number}`]: string
-}
-
-type MacroMessageDescriptor = (
- | {
- id: string
- message?: string
- }
- | {
- id?: string
- message: string
- }
-) & {
- comment?: string
- context?: string
-}
-
/**
- * Translates a message descriptor
- *
- * @example
- * ```
- * import { t } from "@lingui/macro";
- * const message = t({
- * id: "msg.hello",
- * comment: "Greetings at the homepage",
- * message: `Hello ${name}`,
- * });
- * ```
- *
- * @example
- * ```
- * import { t } from "@lingui/macro";
- * const message = t({
- * id: "msg.plural",
- * message: plural(value, { one: "...", other: "..." }),
- * });
- * ```
- *
- * @param descriptor The message descriptor to translate
+ * @deprecated please use `@lingui/core/macro` directly
*/
-export function t(descriptor: MacroMessageDescriptor): string
-
+export * from "@lingui/core/macro"
/**
- * Translates a template string using the global I18n instance
- *
- * @example
- * ```
- * import { t } from "@lingui/macro";
- * const message = t`Hello ${name}`;
- * ```
+ * @deprecated please use `@lingui/react/macro` directly
*/
-export function t(
- literals: TemplateStringsArray,
- ...placeholders: any[]
-): string
-
-/**
- * Translates a template string or message descriptor using a given I18n instance
- *
- * @example
- * ```
- * import { t } from "@lingui/macro";
- * import { I18n } from "@lingui/core";
- * const i18n = new I18n({
- * locale: "nl",
- * messages: { "Hello {0}": "Hallo {0}" },
- * });
- * const message = t(i18n)`Hello ${name}`;
- * ```
- *
- * @example
- * ```
- * import { t } from "@lingui/macro";
- * import { I18n } from "@lingui/core";
- * const i18n = new I18n({
- * locale: "nl",
- * messages: { "Hello {0}": "Hallo {0}" },
- * });
- * const message = t(i18n)({ message: `Hello ${name}` });
- * ```
- */
-export function t(i18n: I18n): {
- (literals: TemplateStringsArray, ...placeholders: any[]): string
- (descriptor: MacroMessageDescriptor): string
-}
-
-/**
- * Pluralize a message
- *
- * @example
- * ```
- * import { plural } from "@lingui/macro";
- * const message = plural(count, {
- * one: "# Book",
- * other: "# Books",
- * });
- * ```
- *
- * @param value Determines the plural form
- * @param options Object with available plural forms
- */
-export function plural(value: number | string, options: ChoiceOptions): string
-
-/**
- * Pluralize a message using ordinal forms
- *
- * Similar to `plural` but instead of using cardinal plural forms,
- * it uses ordinal forms.
- *
- * @example
- * ```
- * import { selectOrdinal } from "@lingui/macro";
- * const message = selectOrdinal(count, {
- * one: "#st",
- * two: "#nd",
- * few: "#rd",
- * other: "#th",
- * });
- * ```
- *
- * @param value Determines the plural form
- * @param options Object with available plural forms
- */
-export function selectOrdinal(
- value: number | string,
- options: ChoiceOptions
-): string
-
-type SelectOptions = {
- /** Catch-all option */
- other: string
- [matches: string]: string
-}
-
-/**
- * Selects a translation based on a value
- *
- * Select works like a switch statement. It will
- * select one of the forms in `options` object which
- * key matches exactly `value`.
- *
- * @example
- * ```
- * import { select } from "@lingui/macro";
- * const message = select(gender, {
- * male: "he",
- * female: "she",
- * other: "they",
- * });
- * ```
- *
- * @param value The key of choices to use
- * @param choices
- */
-export function select(value: string, choices: SelectOptions): string
-
-/**
- * Define a message for later use
- *
- * `defineMessage` can be used to add comments for translators,
- * or to override the message ID.
- *
- * @example
- * ```
- * import { defineMessage } from "@lingui/macro";
- * const message = defineMessage({
- * comment: "Greetings on the welcome page",
- * message: `Welcome, ${name}!`,
- * });
- * ```
- *
- * @param descriptor The message descriptor
- */
-export function defineMessage(
- descriptor: MacroMessageDescriptor
-): MessageDescriptor
-
-/**
- * Define a message for later use
- *
- * @example
- * ```
- * import { defineMessage, msg } from "@lingui/macro";
- * const message = defineMessage`Hello ${name}`;
- *
- * // or using shorter version
- * const message = msg`Hello ${name}`;
- * ```
- */
-export function defineMessage(
- literals: TemplateStringsArray,
- ...placeholders: any[]
-): MessageDescriptor
-
-/**
- * Define a message for later use
- * Alias for {@see defineMessage}
- */
-export const msg: typeof defineMessage
+export * from "@lingui/react/macro"
diff --git a/packages/macro/index.js b/packages/macro/index.js
new file mode 100644
index 000000000..fad7573b3
--- /dev/null
+++ b/packages/macro/index.js
@@ -0,0 +1 @@
+module.exports = require("@lingui/babel-plugin-lingui-macro/macro")
diff --git a/packages/macro/package.json b/packages/macro/package.json
index 3965cdcee..05a2437e4 100644
--- a/packages/macro/package.json
+++ b/packages/macro/package.json
@@ -2,8 +2,7 @@
"name": "@lingui/macro",
"version": "4.8.0-next.1",
"description": "Macro for generating messages in ICU MessageFormat syntax",
- "main": "./dist/index.cjs",
- "module": "./dist/index.mjs",
+ "main": "./index.cjs",
"types": "./index.d.ts",
"sideEffects": false,
"author": {
@@ -11,9 +10,7 @@
"email": "tomas.ehrlich@gmail.com"
},
"scripts": {
- "test:tsd": "tsd",
- "build": "rimraf ./dist && unbuild",
- "stub": "unbuild --stub"
+ "test:tsd": "tsd"
},
"license": "MIT",
"keywords": [
@@ -40,11 +37,7 @@
".": {
"require": {
"types": "./index.d.ts",
- "default": "./dist/index.cjs"
- },
- "import": {
- "types": "./index.d.ts",
- "default": "./dist/index.mjs"
+ "default": "./index.cjs"
}
}
},
@@ -52,10 +45,12 @@
"LICENSE",
"README.md",
"dist/",
- "index.d.ts"
+ "index.d.ts",
+ "index.js"
],
"dependencies": {
- "@lingui/core": "4.8.0-next.1"
+ "@lingui/core": "4.8.0-next.1",
+ "@lingui/react": "4.8.0-next.1"
},
"peerDependencies": {
"@lingui/babel-plugin-lingui-macro": "4.8.0-next.1",
@@ -70,7 +65,6 @@
}
},
"devDependencies": {
- "tsd": "^0.26.1",
- "unbuild": "2.0.0"
+ "tsd": "^0.26.1"
}
}
diff --git a/packages/macro/src/index.ts b/packages/macro/src/index.ts
deleted file mode 100644
index 6da5d128f..000000000
--- a/packages/macro/src/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import macro from "@lingui/babel-plugin-lingui-macro/macro"
-
-export default macro
diff --git a/packages/react.macro/CHANGELOG.md b/packages/react.macro/CHANGELOG.md
deleted file mode 100644
index e69de29bb..000000000
diff --git a/packages/react.macro/README.md b/packages/react.macro/README.md
deleted file mode 100644
index 7673bf64e..000000000
--- a/packages/react.macro/README.md
+++ /dev/null
@@ -1,45 +0,0 @@
-[![License][badge-license]][license]
-[![Version][badge-version]][package]
-[![Downloads][badge-downloads]][package]
-[![Babel Macro][badge-macro]][linguijs]
-
-# @lingui/macro
-
-> [Babel Macros](https://github.com/kentcdodds/babel-plugin-macros) which
-> transforms tagged template literals and JSX components to ICU MessageFormat.
-
-`@lingui/react.macro` is part of [LinguiJS][linguijs]. See the [documentation][documentation]
-for all information, tutorials and examples.
-
-## Installation
-
-```sh
-npm install @lingui/react.macro
-# yarn add @lingui/react.macro
-```
-
-## Usage
-
-See the [reference][reference] documentation.
-
-```jsx
-import { Trans } from "@lingui/react.macro"
-
-function MyComponent() {
- return Hello, my name is ${name}
-}
-```
-
-## License
-
-[MIT][license]
-
-[license]: https://github.com/lingui/js-lingui/blob/main/LICENSE
-[linguijs]: https://github.com/lingui/js-lingui
-[documentation]: https://lingui.dev
-[reference]: https://lingui.dev/ref/macro/
-[package]: https://www.npmjs.com/package/@lingui/react.macro
-[badge-downloads]: https://img.shields.io/npm/dw/@lingui/react.macro.svg
-[badge-version]: https://img.shields.io/npm/v/@lingui/react.macro.svg
-[badge-license]: https://img.shields.io/npm/l/@lingui/react.macro.svg
-[badge-macro]: https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg
diff --git a/packages/react.macro/build.config.ts b/packages/react.macro/build.config.ts
deleted file mode 100644
index ab91d5fa3..000000000
--- a/packages/react.macro/build.config.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { defineBuildConfig } from "unbuild"
-
-export default defineBuildConfig({
- declaration: false,
-})
diff --git a/packages/react.macro/package.json b/packages/react.macro/package.json
deleted file mode 100644
index 2790c55ea..000000000
--- a/packages/react.macro/package.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "name": "@lingui/react.macro",
- "version": "4.8.0-next.1",
- "description": "React Macro for generating messages in ICU MessageFormat syntax",
- "main": "./dist/index.cjs",
- "module": "./dist/index.mjs",
- "types": "./index.d.ts",
- "sideEffects": false,
- "author": {
- "name": "Tim Iatsenko",
- "email": "timiatsenko@gmail.com"
- },
- "scripts": {
- "test:tsd": "tsd",
- "build": "rimraf ./dist && unbuild",
- "stub": "unbuild --stub"
- },
- "license": "MIT",
- "keywords": [
- "babel-plugin-macros",
- "react",
- "i18n",
- "internationalization",
- "i10n",
- "localization",
- "i9n",
- "translation",
- "multilingual"
- ],
- "repository": {
- "type": "git",
- "url": "https://github.com/lingui/js-lingui.git"
- },
- "bugs": {
- "url": "https://github.com/lingui/js-lingui/issues"
- },
- "engines": {
- "node": ">=16.0.0"
- },
- "exports": {
- ".": {
- "require": {
- "types": "./index.d.ts",
- "default": "./dist/index.cjs"
- },
- "import": {
- "types": "./index.d.ts",
- "default": "./dist/index.mjs"
- }
- }
- },
- "files": [
- "LICENSE",
- "README.md",
- "dist/",
- "index.d.ts"
- ],
- "dependencies": {
- "@lingui/macro": "4.8.0-next.1",
- "@lingui/react": "4.8.0-next.1"
- },
- "peerDependencies": {
- "@lingui/babel-plugin-lingui-macro": "4.8.0-next.1",
- "babel-plugin-macros": "2 || 3",
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
- },
- "peerDependenciesMeta": {
- "@lingui/babel-plugin-lingui-macro": {
- "optional": true
- },
- "babel-plugin-macros": {
- "optional": true
- }
- },
- "devDependencies": {
- "@lingui/core": "workspace:*",
- "react": "^18.2.0",
- "tsd": "^0.26.1",
- "unbuild": "2.0.0"
- }
-}
diff --git a/packages/react.macro/src/index.ts b/packages/react.macro/src/index.ts
deleted file mode 100644
index 6da5d128f..000000000
--- a/packages/react.macro/src/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import macro from "@lingui/babel-plugin-lingui-macro/macro"
-
-export default macro
diff --git a/packages/react.macro/tsconfig.json b/packages/react.macro/tsconfig.json
deleted file mode 100644
index 3ea412def..000000000
--- a/packages/react.macro/tsconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "lib": [
- "ES2019.Array"
- ],
- "strict": true,
- "strictNullChecks": false
- }
-}
diff --git a/packages/react.macro/__typetests__/index.test-d.tsx b/packages/react/macro/__typetests__/index.test-d.tsx
similarity index 96%
rename from packages/react.macro/__typetests__/index.test-d.tsx
rename to packages/react/macro/__typetests__/index.test-d.tsx
index 122cc580f..5075b21ab 100644
--- a/packages/react.macro/__typetests__/index.test-d.tsx
+++ b/packages/react/macro/__typetests__/index.test-d.tsx
@@ -1,7 +1,13 @@
import { expectType } from "tsd"
import type { I18n } from "@lingui/core"
-import { Trans, Plural, Select, SelectOrdinal, useLingui } from "../index"
+import {
+ Trans,
+ Plural,
+ Select,
+ SelectOrdinal,
+ useLingui,
+} from "@lingui/react/macro"
import React from "react"
const gender = "male"
diff --git a/packages/react.macro/__typetests__/tsconfig.json b/packages/react/macro/__typetests__/tsconfig.json
similarity index 100%
rename from packages/react.macro/__typetests__/tsconfig.json
rename to packages/react/macro/__typetests__/tsconfig.json
diff --git a/packages/react.macro/index.d.ts b/packages/react/macro/index.d.ts
similarity index 96%
rename from packages/react.macro/index.d.ts
rename to packages/react/macro/index.d.ts
index d1146bad6..13d98ab7d 100644
--- a/packages/react.macro/index.d.ts
+++ b/packages/react/macro/index.d.ts
@@ -1,6 +1,6 @@
import type { ReactNode, VFC, FC } from "react"
import type { TransRenderCallbackOrComponent, I18nContext } from "@lingui/react"
-import type { MacroMessageDescriptor } from "@lingui/macro"
+import type { MacroMessageDescriptor } from "@lingui/core/macro"
type CommonProps = TransRenderCallbackOrComponent & {
id?: string
@@ -55,7 +55,7 @@ export const Trans: FC
*
* @example
* ```
- * import { Plural } from "@lingui/macro"
+ * import { Plural } from "@lingui/core/macro"
*
*
* // ↓ ↓ ↓ ↓ ↓ ↓
diff --git a/packages/react/macro/index.js b/packages/react/macro/index.js
new file mode 100644
index 000000000..fad7573b3
--- /dev/null
+++ b/packages/react/macro/index.js
@@ -0,0 +1 @@
+module.exports = require("@lingui/babel-plugin-lingui-macro/macro")
diff --git a/packages/react.macro/src/index.test.ts b/packages/react/macro/index.test.ts
similarity index 76%
rename from packages/react.macro/src/index.test.ts
rename to packages/react/macro/index.test.ts
index 94a5bd028..0e53cc1a0 100644
--- a/packages/react.macro/src/index.test.ts
+++ b/packages/react/macro/index.test.ts
@@ -1,4 +1,4 @@
-import macro from "@lingui/react.macro"
+import macro from "@lingui/react/macro"
describe("react-macro", () => {
it("Should re-export Macro", () => {
diff --git a/packages/react/package.json b/packages/react/package.json
index 467786ae4..f251a76d5 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -61,16 +61,34 @@
"default": "./dist/server.mjs"
}
},
+ "./macro": {
+ "require": {
+ "types": "./macro/index.d.ts",
+ "default": "./macro/index.js"
+ }
+ },
"./package.json": "./package.json"
},
"files": [
"LICENSE",
"README.md",
- "dist/"
+ "dist/",
+ "macro/index.d.ts",
+ "macro/index.js"
],
"peerDependencies": {
+ "@lingui/babel-plugin-lingui-macro": "4.8.0-next.1",
+ "babel-plugin-macros": "2 || 3",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
+ "peerDependenciesMeta": {
+ "@lingui/babel-plugin-lingui-macro": {
+ "optional": true
+ },
+ "babel-plugin-macros": {
+ "optional": true
+ }
+ },
"dependencies": {
"@babel/runtime": "^7.20.13",
"@lingui/core": "4.8.0-next.1"
diff --git a/packages/vite-plugin/package.json b/packages/vite-plugin/package.json
index 565423e0a..0e7eca0da 100644
--- a/packages/vite-plugin/package.json
+++ b/packages/vite-plugin/package.json
@@ -46,8 +46,8 @@
"vite": "^3 || ^4 || ^5.0.9"
},
"devDependencies": {
+ "@lingui/core": "workspace:^",
"@lingui/format-json": "workspace:^",
- "@lingui/macro": "workspace:^",
"unbuild": "2.0.0",
"vite": "4.1.4",
"vite-plugin-babel-macros": "^1.0.6"
diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts
index e0b060173..a06442b03 100644
--- a/packages/vite-plugin/src/index.ts
+++ b/packages/vite-plugin/src/index.ts
@@ -26,11 +26,12 @@ export function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin[] {
resolveId(id) {
if (
id.includes("@lingui/macro") ||
- id.includes("@lingui/react.macro")
+ id.includes("@lingui/core/macro") ||
+ id.includes("@lingui/react/macro")
) {
throw new Error(
- `The macro you imported from "@lingui/macro" or "@lingui/react.macro" is being executed outside the context of compilation. \n` +
- `This indicates that you don't one of the "babel-plugin-macros" / "@lingui/swc-plugin" / "babel-plugin-lingui-macro" configured correctly. ` +
+ `The macro you imported from "${id}" is being executed outside the context of compilation. \n` +
+ `This indicates that you don't configured correctly one of the "babel-plugin-macros" / "@lingui/swc-plugin" / "babel-plugin-lingui-macro"` +
`Please see the documentation for how to configure Vite with Lingui correctly: ` +
"https://lingui.dev/tutorials/setup-vite"
)
@@ -46,7 +47,8 @@ export function lingui(linguiConfig: LinguiConfigOpts = {}): Plugin[] {
}
config.optimizeDeps.exclude = config.optimizeDeps.exclude || []
config.optimizeDeps.exclude.push("@lingui/macro")
- config.optimizeDeps.exclude.push("@lingui/react.macro")
+ config.optimizeDeps.exclude.push("@lingui/core/macro")
+ config.optimizeDeps.exclude.push("@lingui/react/macro")
},
async transform(src, id) {
if (fileRegex.test(id)) {
diff --git a/packages/vite-plugin/test/index.ts b/packages/vite-plugin/test/index.ts
index 1f946b0c4..4ddd499d5 100644
--- a/packages/vite-plugin/test/index.ts
+++ b/packages/vite-plugin/test/index.ts
@@ -25,18 +25,15 @@ describe("vite-plugin", () => {
await runVite(`no-macro-error/vite.config.ts`)
} catch (e) {
expect(e.stderr).toContain(
- 'The macro you imported from "@lingui/macro" or "@lingui/react.macro" is being executed outside the context of compilation.'
+ 'The macro you imported from "@lingui/core/macro" is being executed outside the context of compilation.'
)
}
}
)
- skipOnWindows(
- "should not report error when macro correctly used",
- async () => {
- const mod = await runVite(`macro-usage/vite.config.ts`)
- expect(await mod.load()).toMatchSnapshot()
- }
- )
+ it("should not report error when macro correctly used", async () => {
+ const mod = await runVite(`macro-usage/vite.config.ts`)
+ expect(await mod.load()).toMatchSnapshot()
+ })
})
async function runVite(configPath: string) {
diff --git a/packages/vite-plugin/test/macro-usage/entrypoint.js b/packages/vite-plugin/test/macro-usage/entrypoint.js
index 89c945333..5a55c8a37 100644
--- a/packages/vite-plugin/test/macro-usage/entrypoint.js
+++ b/packages/vite-plugin/test/macro-usage/entrypoint.js
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export async function load() {
return t`Ola`
diff --git a/packages/vite-plugin/test/no-macro-error/entrypoint.js b/packages/vite-plugin/test/no-macro-error/entrypoint.js
index 89c945333..5a55c8a37 100644
--- a/packages/vite-plugin/test/no-macro-error/entrypoint.js
+++ b/packages/vite-plugin/test/no-macro-error/entrypoint.js
@@ -1,4 +1,4 @@
-import { t } from "@lingui/macro"
+import { t } from "@lingui/core/macro"
export async function load() {
return t`Ola`
diff --git a/tsconfig.json b/tsconfig.json
index 2c9ef8421..976d100e0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,14 +16,15 @@
"./packages/babel-plugin-extract-messages/src"
],
"@lingui/core": ["./packages/core/src"],
+ "@lingui/core/macro": ["./packages/core/macro"],
"@lingui/message-utils/*": ["./packages/message-utils/src/*"],
"@lingui/cli/api": ["./packages/cli/src/api"],
"@lingui/react": ["./packages/react/src"],
+ "@lingui/react/macro": ["./packages/react/macro"],
"@lingui/conf": ["./packages/conf/src"],
"@lingui/babel-plugin-lingui-macro": ["./packages/babel-plugin-lingui-macro/src/index.ts"],
"@lingui/babel-plugin-lingui-macro/macro": ["./packages/babel-plugin-lingui-macro/src/macro.ts"],
- "@lingui/macro": ["./packages/macro/src"],
- "@lingui/react.macro": ["./packages/react.macro/src"],
+ "@lingui/macro": ["./packages/macro"],
"@lingui/format-po": ["./packages/format-po/src/po.ts"],
"@lingui/format-json": ["./packages/format-json/src/json.ts"],
"@lingui/extractor-vue": ["./packages/extractor-vue/src"]
diff --git a/website/docs/guides/message-extraction.md b/website/docs/guides/message-extraction.md
index c7b9e15e7..a4e87e694 100644
--- a/website/docs/guides/message-extraction.md
+++ b/website/docs/guides/message-extraction.md
@@ -167,7 +167,7 @@ While you might think that your code is tree-shakeable, in practice, tree-shakin
To illustrate, let's consider the following code:
```ts
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
export const species = {
Cardano: [
diff --git a/website/docs/introduction.md b/website/docs/introduction.md
index d4754b903..baca125d4 100644
--- a/website/docs/introduction.md
+++ b/website/docs/introduction.md
@@ -55,7 +55,7 @@ Low-level React API is very similar to react-intl and the message format is the
```jsx
import React from "react";
-import { Trans, Plural, useLingui } from "@lingui/macro";
+import { Trans, Plural, useLingui } from "@lingui/core/macro";
export default function Lingui({ numUsers, name = "You" }) {
const { t } = useLingui();
diff --git a/website/docs/ref/macro.mdx b/website/docs/ref/macro.mdx
index 3a845025d..1a43baa47 100644
--- a/website/docs/ref/macro.mdx
+++ b/website/docs/ref/macro.mdx
@@ -67,7 +67,7 @@ The advantages of using macros are:
**JSX macros** are transformed to [`Trans`](/docs/ref/react.md#trans) component from [`@lingui/react`](/docs/ref/react.md):
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Attachment {name} saved;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -79,7 +79,7 @@ import { Trans } from "@lingui/react";
**JS macros** (i.e. macros that looks like a simple JavaScript functions) are transformed into [`i18n._`](/docs/ref/core.md#i18n._) call.
```jsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
t`Attachment ${name} saved`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -103,7 +103,7 @@ The only exception is [`defineMessage`](/docs/ref/macro.mdx#definemessage) which
```jsx
import { i18n } from "@lingui/core"
-import { defineMessage } from "@lingui/macro"
+import { defineMessage } from "@lingui/core/macro"
// define message
const message = defineMessage({ message: `Attachment ${name} saved` })
@@ -347,7 +347,7 @@ In the examples below you might notice `/*i18n*/` comment in macro output. This
The most common macro for messages. It transforms tagged template literal into message in ICU MessageFormat:
```js
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const message = t`Hello World`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -364,7 +364,7 @@ const message = i18n._(
Message variables are supported:
```js
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const message = t`My name is ${name}`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -382,7 +382,7 @@ const message = i18n._(
In fact, any expression can be used inside template literal. However, only simple variables are referenced by name in a transformed message. All other expressions are referenced by numeric index:
```js
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const message = t`Today is ${new Date()}`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -401,7 +401,7 @@ const message = i18n._(
Optionally, a custom `i18n` instance can be passed that can be used instead of the global instance:
```jsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
import { i18nCustom } from "./lingui";
const message = t(i18nCustom)`Hello World`;
@@ -421,7 +421,7 @@ const message = i18nCustom._(
It's also possible to pass custom `id` and `comment` for translators by calling `t` macro with a message descriptor:
```jsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const message = t({
id: "msg.hello",
comment: "Greetings at the homepage",
@@ -444,7 +444,7 @@ const message = i18n._(
In this case the `message` is used as a default message and it's transformed as if it were wrapped in `t` macro. `message` also accepts any other macros:
```js
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const message = t({
id: "msg.plural",
message: plural(value, { one: "...", other: "..." }),
@@ -471,7 +471,7 @@ plural(value: string | number, options: Object)
`plural` macro is used for pluralization, e.g: messages which has different form based on counter. The first argument `value` determines the plural form. The second argument is an object with available plural forms. Plural form used in the source code depends on your source locale (e.g. English has only `one` and `other`).
```js
-import { plural } from "@lingui/macro";
+import { plural } from "@lingui/core/macro";
const message = plural(count, {
one: "# Book",
other: "# Books",
@@ -492,7 +492,7 @@ const message = i18n._(
If you need to add variables to plural form, you can use template string literals. This time [`t`](/docs/ref/macro.mdx#t) macro isn't required as template strings are transformed automatically:
```js
-import { plural } from "@lingui/macro";
+import { plural } from "@lingui/core/macro";
const message = plural(count, {
one: `${name} has # friend`,
other: `${name} has # friends`,
@@ -513,7 +513,7 @@ const message = i18n._(
Plurals can also be nested to form complex messages. Here's an example using two counters:
```js
-import { plural } from "@lingui/macro";
+import { plural } from "@lingui/core/macro";
const message = plural(numBooks, {
one: plural(numArticles, {
one: `1 book and 1 article`,
@@ -576,7 +576,7 @@ selectOrdinal(value: string | number, options: Object)
`selectOrdinal` macro is similar to [`plural`](#plural) but instead of using cardinal plural forms it uses ordinal forms:
```js
-import { selectOrdinal } from "@lingui/macro";
+import { selectOrdinal } from "@lingui/core/macro";
const message = selectOrdinal(count, {
one: "#st",
two: "#nd",
@@ -623,7 +623,7 @@ select(value: string | number, options: Object)
`select` macro works as a switch statement — it select one of the forms provided in `options` object which key matches exactly `value`:
```js
-import { select } from "@lingui/macro";
+import { select } from "@lingui/core/macro";
const message = select(gender, {
male: "he",
female: "she",
@@ -667,7 +667,7 @@ const message = t({
In other words, `t` returns a translated string at the time when it's called, while `msg` returns a `MessageDescriptor` that can produce translated strings later.
```ts
-import { defineMessage } from "@lingui/macro";
+import { defineMessage } from "@lingui/core/macro";
const message = defineMessage`Hello World`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -681,7 +681,7 @@ const message = /*i18n*/ {
You also can use shorter alias of `defineMessage` macro:
```ts
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
const message = msg`Hello World`;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -706,7 +706,7 @@ type MacroMessageDescriptor = {
Either `id` or `message` property is required. `id` is a custom message ID. If it isn't set, the `message` (and `context` if provided) are used for generating an ID.
```js
-import { defineMessage } from "@lingui/macro";
+import { defineMessage } from "@lingui/core/macro";
const message = defineMessage({
id: "Navigation / About",
message: "About us",
@@ -723,7 +723,7 @@ const message = /*i18n*/ {
`message` is the default message. Any JS macro can be used here. Template string literals don't need to be tagged with [`t`](#t).
```js
-import { defineMessage } from "@lingui/macro";
+import { defineMessage } from "@lingui/core/macro";
const name = "Joe";
@@ -747,7 +747,7 @@ const message = /*i18n*/ {
`comment` is a comment for translators. It's extracted to the message catalog and it gives translators extra information about the message. It's removed from the production code:
```js
-import { defineMessage } from "@lingui/macro";
+import { defineMessage } from "@lingui/core/macro";
const message = defineMessage({
comment: "Link in navigation pointing to About page",
message: "About us",
@@ -766,7 +766,7 @@ const message = /*i18n*/ {
In production build, the macro is stripped of `message`, `comment` and `context` properties:
```js
-import { defineMessage } from "@lingui/macro";
+import { defineMessage } from "@lingui/core/macro";
const message = defineMessage({
id: "msg.navigation.about",
comment: "Link in navigation pointing to About page",
@@ -805,7 +805,7 @@ Each message in catalog is identified by **message ID**.
While macro uses message (and `context` property if provided) to generate ID, it's possible to override it.
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Attachment {name} saved.;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -831,7 +831,7 @@ Contextual information for translators. Similar to [`comment`](#comment) but als
It's removed from the production code. See [Context](/docs/tutorials/explicit-vs-generated-ids.md#context) for more details.
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Refresh inbox;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -843,7 +843,7 @@ import { Trans } from "@lingui/react";
Lingui generates different IDs when `context` is provided:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
right;
right;
@@ -857,7 +857,7 @@ import { Trans } from "@lingui/react";
Custom `id` is preserved:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Attachment {name} saved.;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -869,7 +869,7 @@ import { Trans } from "@lingui/react";
This macro is especially useful when message contains inline markup.
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Read the docs.
@@ -877,7 +877,7 @@ import { Trans } from "@lingui/macro";
// ↓ ↓ ↓ ↓ ↓ ↓
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
}} />;
```
@@ -907,7 +907,7 @@ Components and HTML tags are replaced with dummy indexed tags (`<0>0>`) which
Props of [`Plural`](/docs/ref/macro.mdx#plural-1) macro are transformed into [`plural`](/docs/guides/message-format.md) format.
```jsx
-import { Plural } from "@lingui/macro";
+import { Plural } from "@lingui/core/macro";
;
// ↓ ↓ ↓ ↓ ↓ ↓
@@ -921,7 +921,7 @@ import { Trans } from "@lingui/react";
Exact matches in MessageFormat syntax are expressed as `=int` (e.g. `=0`), but in React this isn't a valid prop name. Therefore, exact matches are expressed as `_int` prop (e.g. `_0`). This is commonly used in combination with `offset` prop. `offset` affects only plural forms, not exact matches.
```jsx
-import { Plural } from "@lingui/macro";
+import { Plural } from "@lingui/core/macro";
` inside `` macro if you want to provide `id`, `context` or
Props of `SelectOrdinal` macro are transformed into [`selectOrdinal`](/docs/guides/message-format.md) format:
```jsx
-import { SelectOrdinal } from "@lingui/macro";
+import { SelectOrdinal } from "@lingui/core/macro";
// count == 1 -> 1st
// count == 2 -> 2nd
@@ -1007,7 +1007,7 @@ The select cases except `other` should be prefixed with underscore: `_male` or `
Props of `Select` macro are transformed into [`select`](/docs/guides/message-format.md) format:
```jsx
-import { Select } from "@lingui/macro";
+import { Select } from "@lingui/core/macro";
// gender == "female" -> Her book
// gender == "male" -> His book
@@ -1040,7 +1040,7 @@ It returns an object with the following content:
| `defaultComponent` | `React.ComponentType` | the same `defaultComponent` you passed to `I18nProvider`, if provided |
```jsx
-import { useLingui } from "@lingui/macro";
+import { useLingui } from "@lingui/core/macro";
function MyComponent() {
const { t } = useLingui();
diff --git a/website/docs/ref/react.md b/website/docs/ref/react.md
index f591c5884..6be6876ee 100644
--- a/website/docs/ref/react.md
+++ b/website/docs/ref/react.md
@@ -139,7 +139,7 @@ const CurrentLocale = () => {
There is a [macro version](/docs/ref/macro.mdx#uselingui) of the `useLingui` hook which supports all features of the [`t` macro](/docs/ref/macro.mdx#t) and uses the runtime `useLingui` hook (from `@lingui/react`) under the hood.
```jsx
-import { useLingui } from "@lingui/macro";
+import { useLingui } from "@lingui/core/macro";
const CurrentLocale = () => {
const { t } = useLingui();
@@ -169,7 +169,7 @@ This section is intended for reference purposes.
Import [`Trans`](/docs/ref/macro.mdx#trans) macro instead of [`Trans`](#trans) component if you use macros:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
// Trans from @lingui/react won't work in this case
// import { Trans } from "@lingui/react"
diff --git a/website/docs/releases/migration-3.md b/website/docs/releases/migration-3.md
index d6c269c74..2f720195d 100644
--- a/website/docs/releases/migration-3.md
+++ b/website/docs/releases/migration-3.md
@@ -186,7 +186,7 @@ npm install --dev @lingui/macro babel-plugin-macros
```diff
- import { Trans } from "@lingui/react"
- + import { Trans } from "@lingui/macro"
+ + import { Trans } from "@lingui/core/macro"
```
:::caution Note
@@ -207,7 +207,7 @@ These macros automatically binds message to default `i18n` object:
```diff
import { i18n } from "@lingui/core"
- + import { t } from "@lingui/macro"
+ + import { t } from "@lingui/core/macro"
- i18n.t`Hello World`
+ t`Hello World`
diff --git a/website/docs/releases/migration-4.md b/website/docs/releases/migration-4.md
index f2b362b93..eca189162 100644
--- a/website/docs/releases/migration-4.md
+++ b/website/docs/releases/migration-4.md
@@ -104,7 +104,7 @@ Prior to v4, these formats used the source message as the message ID. Now they u
If you have been using the following pattern in your code:
```tsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
const myMsg = t`Hello world!`;
@@ -120,7 +120,7 @@ Due to the changes caused by hash-based message ID feature described earlier, th
Instead, please use [recommended](/docs/tutorials/react-patterns.md#lazy-translations) pattern for such translations:
```tsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
import { useLingui } from "@lingui/react";
const myMsg = msg`Hello world!`;
diff --git a/website/docs/tutorials/explicit-vs-generated-ids.md b/website/docs/tutorials/explicit-vs-generated-ids.md
index 5f4f0e6e9..818e0cdc0 100644
--- a/website/docs/tutorials/explicit-vs-generated-ids.md
+++ b/website/docs/tutorials/explicit-vs-generated-ids.md
@@ -74,7 +74,7 @@ msgstr "LinguiJS przyklad"
### With [`Trans`](/docs/ref/macro.mdx#trans) macro
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
function render() {
return (
@@ -112,7 +112,7 @@ const catalog = [
In the following example, the message `Hello World` will be extracted and used to create an ID.
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
msg`Hello World`;
```
@@ -131,7 +131,7 @@ Regardless of whether you use generated IDs or not, adding context makes the tra
#### Providing context for a message
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
right;
right;
@@ -145,7 +145,7 @@ import { Trans } from "@lingui/react";
or with non-jsx macro
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
const ex1 = msg({
message: `right`,
@@ -175,7 +175,7 @@ const ex2 = {
If you're using custom IDs in your project, add `id` prop to i18n components:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
function render() {
return (
@@ -200,7 +200,7 @@ The messages with IDs `msg.header` and `msg.hello` will be extracted with their
If you're using custom IDs in your project, call the [`msg`](/docs/ref/macro.mdx#definemessage) function with a message descriptor object, passing the ID using the `id` property:
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
msg({ id: "msg.greeting", message: `Hello World` });
```
@@ -210,7 +210,7 @@ Message `msg.greeting` will be extracted with default value `Hello World`.
For all other js macros ([`plural`](/docs/ref/macro.mdx#plural), [`select`](/docs/ref/macro.mdx#select), [`selectOrdinal`](/docs/ref/macro.mdx#selectordinal), use them inside [`msg`](/docs/ref/macro.mdx#definemessage) macro to pass ID (in this case, `'msg.caption'`).
```jsx
-import { msg, plural } from "@lingui/macro";
+import { msg, plural } from "@lingui/core/macro";
msg({
id: "msg.caption",
diff --git a/website/docs/tutorials/javascript.md b/website/docs/tutorials/javascript.md
index 1ae7c7ec8..8f779da0d 100644
--- a/website/docs/tutorials/javascript.md
+++ b/website/docs/tutorials/javascript.md
@@ -61,7 +61,7 @@ i18n.activate("en");
Once that is done, we can go ahead and use it! Wrap your text in [`t`](/docs/ref/macro.mdx#t) macro:
```js
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
t`Hello World!`;
// becomes "Salut le monde!"
@@ -74,7 +74,7 @@ t`My name is ${name}`;
Plurals and selections are possible using plural and select methods:
```js
-import { plural } from "@lingui/macro";
+import { plural } from "@lingui/core/macro";
const count = 42;
@@ -88,7 +88,7 @@ plural(count, {
It's also possible to nest message formats. Each message format method in i18n has a standalone companion, which only returns message without performing the translation:
```js
-import { t, select, plural } from "@lingui/macro"
+import { t, select, plural } from "@lingui/core/macro"
select(gender, {
offset: 1,
diff --git a/website/docs/tutorials/react-native.md b/website/docs/tutorials/react-native.md
index 6c1e77a9f..90dc79c9f 100644
--- a/website/docs/tutorials/react-native.md
+++ b/website/docs/tutorials/react-native.md
@@ -135,7 +135,7 @@ The interplay of `I18nProvider` and `useLingui` is shown in the following simpli
```tsx
import { I18nProvider } from "@lingui/react";
-import { Trans, useLingui } from "@lingui/macro";
+import { Trans, useLingui } from "@lingui/core/macro";
import { i18n } from "@lingui/core";
diff --git a/website/docs/tutorials/react-patterns.md b/website/docs/tutorials/react-patterns.md
index d426e8b56..2e77241e1 100644
--- a/website/docs/tutorials/react-patterns.md
+++ b/website/docs/tutorials/react-patterns.md
@@ -14,7 +14,7 @@ Using jsx macros is the most straightforward way to translate your React compone
[`Trans`](/docs/ref/macro.mdx#trans) handles translations of messages including variables and other React components:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
function render() {
return (
@@ -45,7 +45,7 @@ Sometimes you can't use [`Trans`](/docs/ref/macro.mdx#trans) component, for exam
In such case you need to use the [`useLingui()`](/docs/ref/macro.mdx#uselingui) macro:
```jsx
-import { useLingui } from "@lingui/macro";
+import { useLingui } from "@lingui/core/macro";
export default function ImageWithCaption() {
const { t } = useLingui();
@@ -57,7 +57,7 @@ export default function ImageWithCaption() {
If `useLingui` macro is not available in your setup you can use the [`useLingui()`](/docs/ref/react.md#uselingui) runtime hook with the [`msg`](/docs/ref/macro.mdx#definemessage) macro.
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
import { useLingui } from "@lingui/react";
export default function ImageWithCaption() {
@@ -72,7 +72,7 @@ export default function ImageWithCaption() {
Sometimes, you may need to access translations outside React components, which is another common pattern. You can use [`t`](/docs/ref/macro.mdx#t) macro outside React context as usual:
```jsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
export function showAlert() {
alert(t`...`);
@@ -85,7 +85,7 @@ When you use [`t`](/docs/ref/macro.mdx#t) macro (and [`plural`](/docs/ref/macro.
For better control and flexibility, it's a good idea to avoid the global `i18n` instance and instead use a specific instance tailored to your needs.
```ts
-import { msg, useLingui } from "@lingui/macro";
+import { msg, useLingui } from "@lingui/core/macro";
import { I18n } from "@lingui/core";
export function showAlert(i18n: I18n) {
@@ -109,7 +109,7 @@ Note that we import `useLingui` from `@lingui/macro`. There is also a runtime ve
All js macros such as [`t`](/docs/ref/macro.mdx#t) [`plural`](/docs/ref/macro.mdx#plural), [`select`](/docs/ref/macro.mdx#select), [`selectOrdinal`](/docs/ref/macro.mdx#selectordinal) cannot be used on the module level.
```jsx
-import { t } from "@lingui/macro";
+import { t } from "@lingui/core/macro";
// ❌ Bad! This won't work because the `t` macro is used at the module level.
// The `t` macro returns a string, and once this string is assigned, it won't react to locale changes.
@@ -132,7 +132,7 @@ A better option would be to use the Lazy Translations pattern described in the f
You don't need to declare messages at the same code location where they are displayed. Tag a string with the [`msg`](/docs/ref/macro.mdx#definemessage) macro, and you've created a "message descriptor", which can then be passed around as a variable, and can be displayed as a translated string by passing its `id` to [`Trans`](/docs/ref/macro.mdx#trans) as its `id` prop:
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
import { Trans } from "@lingui/react";
const favoriteColors = [msg`Red`, msg`Orange`, msg`Yellow`, msg`Green`];
@@ -158,7 +158,7 @@ To render the message descriptor as a string-only translation, pass it to the [`
```jsx
import { i18n } from "@lingui/core";
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
const favoriteColors = [msg`Red`, msg`Orange`, msg`Yellow`, msg`Green`];
@@ -174,7 +174,7 @@ Sometimes you need to pick between different messages to display, depending on t
A simple way to do this is to create an object that maps the possible values of "status" to message descriptors (tagged with the [`msg`](/docs/ref/macro.mdx#definemessage) macro), and render them as needed with deferred translation:
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
import { useLingui } from "@lingui/react";
const statusMessages = {
@@ -201,7 +201,7 @@ To avoid bugs with stale translations, use the `_` function returned from [`useL
Keep in mind that `useMemo` is primarily a performance optimization tool in React. Because of this, there might be no need to memoize your translations. Additionally, this issue is not present when using the `Trans` component which we recommend to use when possible.
```jsx
-import { msg } from "@lingui/macro";
+import { msg } from "@lingui/core/macro";
import { i18n } from "@lingui/core";
const welcomeMessage = msg`Welcome!`;
@@ -253,7 +253,7 @@ export function Welcome() {
Note on [`useLingui`](/docs/ref/macro.mdx#uselingui) macro usage. The `t` function destructured from this hook, behaves the same way as `_` from the runtime [`useLingui`](/docs/ref/react.md#uselingui) counterpart, so you can safely use it in the dependency array.
```ts
-import { useLingui } from "@lingui/macro";
+import { useLingui } from "@lingui/core/macro";
export function Welcome() {
const { t } = useLingui();
diff --git a/website/docs/tutorials/react.md b/website/docs/tutorials/react.md
index d97ed680e..a0ec16343 100644
--- a/website/docs/tutorials/react.md
+++ b/website/docs/tutorials/react.md
@@ -114,7 +114,7 @@ Let's start with the basics - static messages. These messages don't have any var
All we need to make this heading translatable is wrap it in [`Trans`](/docs/ref/macro.mdx#trans) macro:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Message Inbox
@@ -130,7 +130,7 @@ In general, macros are executed at compile time and they transform source code i
Under the hood, all JSX macros are transformed into [`Trans`](/docs/ref/react.md#trans) component. Take a look at this short example. This is what we write:
```jsx
-import { Trans } from "@lingui/macro";
+import { Trans } from "@lingui/core/macro";
Hello {name};
```
@@ -536,7 +536,7 @@ How do we know which plural form we should use? It's very simple: we, as develop
We don't need to select these forms manually. We'll use [`Plural`](/docs/ref/macro.mdx#plural-1) component, which takes a `value` prop and based on the active language, selects the right plural form:
```jsx
-import { Trans, Plural } from "@lingui/macro";
+import { Trans, Plural } from "@lingui/core/macro";
@@ -702,7 +702,7 @@ After all modifications, the final component with i18n looks like this:
```jsx title="src/Inbox.js"
import React from "react";
-import { Trans, Plural, useLingui } from "@lingui/macro";
+import { Trans, Plural, useLingui } from "@lingui/core/macro";
export default function Inbox() {
const { i18n, t } = useLingui();
diff --git a/website/src/components/Code.tsx b/website/src/components/Code.tsx
index 2ab49a0af..34ef4d038 100644
--- a/website/src/components/Code.tsx
+++ b/website/src/components/Code.tsx
@@ -10,7 +10,7 @@ const Code = (): React.ReactElement => {
const { withBaseUrl } = useBaseUrlUtils();
const codeSample = `
-import { Trans } from "@lingui/react.macro"
+import { Trans } from "@lingui/react/macro"
function App() {
return (
diff --git a/yarn.lock b/yarn.lock
index 119b68e7c..2da0f7a6c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3476,7 +3476,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@lingui/core@4.8.0-next.1, @lingui/core@workspace:*, @lingui/core@workspace:packages/core":
+"@lingui/core@4.8.0-next.1, @lingui/core@workspace:*, @lingui/core@workspace:^, @lingui/core@workspace:packages/core":
version: 0.0.0-use.local
resolution: "@lingui/core@workspace:packages/core"
dependencies:
@@ -3485,6 +3485,14 @@ __metadata:
"@lingui/message-utils": 4.8.0-next.1
unbuild: 2.0.0
unraw: ^3.0.0
+ peerDependencies:
+ "@lingui/babel-plugin-lingui-macro": 4.8.0-next.1
+ babel-plugin-macros: 2 || 3
+ peerDependenciesMeta:
+ "@lingui/babel-plugin-lingui-macro":
+ optional: true
+ babel-plugin-macros:
+ optional: true
languageName: unknown
linkType: soft
@@ -3595,13 +3603,13 @@ __metadata:
languageName: unknown
linkType: soft
-"@lingui/macro@4.8.0-next.1, @lingui/macro@workspace:^, @lingui/macro@workspace:packages/macro":
+"@lingui/macro@workspace:packages/macro":
version: 0.0.0-use.local
resolution: "@lingui/macro@workspace:packages/macro"
dependencies:
"@lingui/core": 4.8.0-next.1
+ "@lingui/react": 4.8.0-next.1
tsd: ^0.26.1
- unbuild: 2.0.0
peerDependencies:
"@lingui/babel-plugin-lingui-macro": 4.8.0-next.1
babel-plugin-macros: 2 || 3
@@ -3633,28 +3641,6 @@ __metadata:
languageName: node
linkType: hard
-"@lingui/react.macro@workspace:packages/react.macro":
- version: 0.0.0-use.local
- resolution: "@lingui/react.macro@workspace:packages/react.macro"
- dependencies:
- "@lingui/core": "workspace:*"
- "@lingui/macro": 4.8.0-next.1
- "@lingui/react": 4.8.0-next.1
- react: ^18.2.0
- tsd: ^0.26.1
- unbuild: 2.0.0
- peerDependencies:
- "@lingui/babel-plugin-lingui-macro": 4.8.0-next.1
- babel-plugin-macros: 2 || 3
- react: ^16.8.0 || ^17.0.0 || ^18.0.0
- peerDependenciesMeta:
- "@lingui/babel-plugin-lingui-macro":
- optional: true
- babel-plugin-macros:
- optional: true
- languageName: unknown
- linkType: soft
-
"@lingui/react@4.8.0-next.1, @lingui/react@workspace:*, @lingui/react@workspace:packages/react":
version: 0.0.0-use.local
resolution: "@lingui/react@workspace:packages/react"
@@ -3670,7 +3656,14 @@ __metadata:
react-dom: ^18.2.0
unbuild: 2.0.0
peerDependencies:
+ "@lingui/babel-plugin-lingui-macro": 4.8.0-next.1
+ babel-plugin-macros: 2 || 3
react: ^16.8.0 || ^17.0.0 || ^18.0.0
+ peerDependenciesMeta:
+ "@lingui/babel-plugin-lingui-macro":
+ optional: true
+ babel-plugin-macros:
+ optional: true
languageName: unknown
linkType: soft
@@ -3691,8 +3684,8 @@ __metadata:
dependencies:
"@lingui/cli": 4.8.0-next.1
"@lingui/conf": 4.8.0-next.1
+ "@lingui/core": "workspace:^"
"@lingui/format-json": "workspace:^"
- "@lingui/macro": "workspace:^"
unbuild: 2.0.0
vite: 4.1.4
vite-plugin-babel-macros: ^1.0.6