Skip to content

Commit 7b71d11

Browse files
committed
Merge branch 'main' into chore/deprecate-intl-wrappers
2 parents 495f178 + 27154ab commit 7b71d11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1445
-158
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [5.7.0](https://github.com/lingui/js-lingui/compare/v5.6.1...v5.7.0) (2025-12-12)
7+
8+
### Bug Fixes
9+
10+
* **cli:** allow using PO formatter function with Translation.IO ([#2375](https://github.com/lingui/js-lingui/issues/2375)) ([f8b90e2](https://github.com/lingui/js-lingui/commit/f8b90e2ff05657b2af17568cb8c8279eb9484719))
11+
* Gettext formatter merges duplicate plural entries ([#2347](https://github.com/lingui/js-lingui/issues/2347)) ([d72b23f](https://github.com/lingui/js-lingui/commit/d72b23f38f3dcffb5809964aaeb07cfcfaa8ec48))
12+
13+
### Features
14+
15+
* **cli:** add --output-prefix option to customize compiled file headers ([#2377](https://github.com/lingui/js-lingui/issues/2377)) ([ef77310](https://github.com/lingui/js-lingui/commit/ef77310e1ec664f8c059bc16179c169c818f1801))
16+
617
## [5.6.1](https://github.com/lingui/js-lingui/compare/v5.6.0...v5.6.1) (2025-11-28)
718

819
### Bug Fixes

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "5.6.1",
2+
"version": "5.7.0",
33
"packages": ["packages/*"],
44
"npmClient": "yarn",
55
"command": {

packages/babel-plugin-extract-messages/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [5.7.0](https://github.com/lingui/js-lingui/compare/v5.6.1...v5.7.0) (2025-12-12)
7+
8+
**Note:** Version bump only for package @lingui/babel-plugin-extract-messages
9+
610
## [5.6.1](https://github.com/lingui/js-lingui/compare/v5.6.0...v5.6.1) (2025-11-28)
711

812
**Note:** Version bump only for package @lingui/babel-plugin-extract-messages

packages/babel-plugin-extract-messages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lingui/babel-plugin-extract-messages",
3-
"version": "5.6.1",
3+
"version": "5.7.0",
44
"description": "Babel plugin for collecting messages from source code for internationalization",
55
"main": "./dist/index.cjs",
66
"module": "./dist/index.mjs",

packages/babel-plugin-lingui-macro/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [5.7.0](https://github.com/lingui/js-lingui/compare/v5.6.1...v5.7.0) (2025-12-12)
7+
8+
**Note:** Version bump only for package @lingui/babel-plugin-lingui-macro
9+
610
## [5.6.1](https://github.com/lingui/js-lingui/compare/v5.6.0...v5.6.1) (2025-11-28)
711

812
### Bug Fixes

packages/babel-plugin-lingui-macro/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lingui/babel-plugin-lingui-macro",
3-
"version": "5.6.1",
3+
"version": "5.7.0",
44
"description": "Babel plugin for transforming Lingui Macros",
55
"main": "./dist/index.cjs",
66
"module": "./dist/index.mjs",
@@ -86,9 +86,9 @@
8686
"@babel/core": "^7.20.12",
8787
"@babel/runtime": "^7.20.13",
8888
"@babel/types": "^7.20.7",
89-
"@lingui/conf": "5.6.1",
90-
"@lingui/core": "5.6.1",
91-
"@lingui/message-utils": "5.6.1"
89+
"@lingui/conf": "5.7.0",
90+
"@lingui/core": "5.7.0",
91+
"@lingui/message-utils": "5.7.0"
9292
},
9393
"peerDependencies": {
9494
"babel-plugin-macros": "2 || 3"

packages/cli/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [5.7.0](https://github.com/lingui/js-lingui/compare/v5.6.1...v5.7.0) (2025-12-12)
7+
8+
### Bug Fixes
9+
10+
* **cli:** allow using PO formatter function with Translation.IO ([#2375](https://github.com/lingui/js-lingui/issues/2375)) ([f8b90e2](https://github.com/lingui/js-lingui/commit/f8b90e2ff05657b2af17568cb8c8279eb9484719))
11+
12+
### Features
13+
14+
* **cli:** add --output-prefix option to customize compiled file headers ([#2377](https://github.com/lingui/js-lingui/issues/2377)) ([ef77310](https://github.com/lingui/js-lingui/commit/ef77310e1ec664f8c059bc16179c169c818f1801))
15+
616
## [5.6.1](https://github.com/lingui/js-lingui/compare/v5.6.0...v5.6.1) (2025-11-28)
717

818
**Note:** Version bump only for package @lingui/cli

packages/cli/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lingui/cli",
3-
"version": "5.6.1",
3+
"version": "5.7.0",
44
"description": "CLI for working wit message catalogs",
55
"keywords": [
66
"cli",
@@ -62,12 +62,12 @@
6262
"@babel/parser": "^7.22.0",
6363
"@babel/runtime": "^7.21.0",
6464
"@babel/types": "^7.21.2",
65-
"@lingui/babel-plugin-extract-messages": "5.6.1",
66-
"@lingui/babel-plugin-lingui-macro": "5.6.1",
67-
"@lingui/conf": "5.6.1",
68-
"@lingui/core": "5.6.1",
69-
"@lingui/format-po": "5.6.1",
70-
"@lingui/message-utils": "5.6.1",
65+
"@lingui/babel-plugin-extract-messages": "5.7.0",
66+
"@lingui/babel-plugin-lingui-macro": "5.7.0",
67+
"@lingui/conf": "5.7.0",
68+
"@lingui/core": "5.7.0",
69+
"@lingui/format-po": "5.7.0",
70+
"@lingui/message-utils": "5.7.0",
7171
"chokidar": "3.5.1",
7272
"cli-table": "^0.3.11",
7373
"commander": "^10.0.0",
@@ -82,7 +82,7 @@
8282
"picocolors": "^1.1.1",
8383
"pofile": "^1.1.4",
8484
"pseudolocale": "^2.0.0",
85-
"source-map": "^0.8.0-beta.0",
85+
"source-map": "^0.7.6",
8686
"threads": "^1.7.0"
8787
},
8888
"devDependencies": {

packages/cli/src/api/compile.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,45 @@ describe("createCompiledCatalog", () => {
288288
})
289289
})
290290

291+
describe("options.outputPrefix", () => {
292+
const getCompiledCatalog = (outputPrefix?: string) =>
293+
createCompiledCatalog(
294+
"en",
295+
{
296+
Hello: "Hello",
297+
},
298+
{
299+
outputPrefix,
300+
}
301+
).source
302+
303+
it("should use default eslint-disable directive when not specified", () => {
304+
const result = getCompiledCatalog()
305+
expect(result).toContain("/*eslint-disable*/")
306+
})
307+
308+
it("should use oxlint-disable directive", () => {
309+
const result = getCompiledCatalog("/*oxlint-disable*/")
310+
expect(result).toContain("/*oxlint-disable*/")
311+
})
312+
313+
it("should use custom prefix when specified", () => {
314+
const result = getCompiledCatalog("/*biome-ignore lint: auto-generated*/")
315+
expect(result).toContain("/*biome-ignore lint: auto-generated*/")
316+
expect(result).not.toContain("eslint-disable")
317+
})
318+
319+
it("should handle empty string prefix (no header)", () => {
320+
const result = getCompiledCatalog("")
321+
expect(
322+
result.startsWith("export") ||
323+
result.startsWith("module") ||
324+
result.startsWith("window") ||
325+
result.startsWith("global")
326+
).toBeTruthy()
327+
})
328+
})
329+
291330
it("should return list of compile errors", () => {
292331
const res = createCompiledCatalog(
293332
"ru",

packages/cli/src/api/compile.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type CreateCompileCatalogOptions = {
1717
namespace?: CompiledCatalogNamespace
1818
pseudoLocale?: string
1919
compilerBabelOptions?: GeneratorOptions
20+
outputPrefix?: string
2021
}
2122

2223
export type MessageCompilationError = {
@@ -44,6 +45,7 @@ export function createCompiledCatalog(
4445
namespace = "cjs",
4546
pseudoLocale,
4647
compilerBabelOptions = {},
48+
outputPrefix = "/*eslint-disable*/",
4749
} = options
4850
const shouldPseudolocalize = locale === pseudoLocale
4951

@@ -91,7 +93,7 @@ export function createCompiledCatalog(
9193
...compilerBabelOptions,
9294
}).code
9395

94-
return { source: "/*eslint-disable*/" + code, errors }
96+
return { source: `${outputPrefix}` + code, errors }
9597
}
9698

9799
function buildExportStatement(

0 commit comments

Comments
 (0)