@lingui/format-po-gettext 6.0.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/po-gettext.mjs +16 -6
- package/package.json +7 -6
package/dist/po-gettext.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from '@messageformat/parser';
|
|
2
|
-
import
|
|
2
|
+
import { parsePo, stringifyPo, createItem } from 'pofile-ts';
|
|
3
3
|
import { generateMessageId } from '@lingui/message-utils/generateMessageId';
|
|
4
4
|
import { formatter as formatter$1 } from '@lingui/format-po';
|
|
5
5
|
|
|
@@ -3447,7 +3447,7 @@ function expandMergedPluralEntries(items, options) {
|
|
|
3447
3447
|
continue;
|
|
3448
3448
|
}
|
|
3449
3449
|
for (const variable of variableList) {
|
|
3450
|
-
const newItem =
|
|
3450
|
+
const newItem = createItem();
|
|
3451
3451
|
newItem.msgid = item.msgid;
|
|
3452
3452
|
newItem.msgid_plural = item.msgid_plural;
|
|
3453
3453
|
newItem.msgstr = [...item.msgstr];
|
|
@@ -3476,11 +3476,18 @@ function formatter(options = {}) {
|
|
|
3476
3476
|
...options
|
|
3477
3477
|
};
|
|
3478
3478
|
const formatter2 = formatter$1(options);
|
|
3479
|
+
const serializeOptions = {};
|
|
3480
|
+
if (options.foldLength !== void 0) {
|
|
3481
|
+
serializeOptions.foldLength = options.foldLength;
|
|
3482
|
+
}
|
|
3483
|
+
if (options.compactMultiline !== void 0) {
|
|
3484
|
+
serializeOptions.compactMultiline = options.compactMultiline;
|
|
3485
|
+
}
|
|
3479
3486
|
return {
|
|
3480
3487
|
catalogExtension: ".po",
|
|
3481
3488
|
templateExtension: ".pot",
|
|
3482
3489
|
parse(content, ctx) {
|
|
3483
|
-
const po =
|
|
3490
|
+
const po = parsePo(content);
|
|
3484
3491
|
if (options.mergePlurals) {
|
|
3485
3492
|
po.items = expandMergedPluralEntries(po.items, options);
|
|
3486
3493
|
}
|
|
@@ -3502,10 +3509,13 @@ function formatter(options = {}) {
|
|
|
3502
3509
|
options.customICUPrefix
|
|
3503
3510
|
);
|
|
3504
3511
|
});
|
|
3505
|
-
return formatter2.parse(
|
|
3512
|
+
return formatter2.parse(
|
|
3513
|
+
stringifyPo(po, serializeOptions),
|
|
3514
|
+
ctx
|
|
3515
|
+
);
|
|
3506
3516
|
},
|
|
3507
3517
|
serialize(catalog, ctx) {
|
|
3508
|
-
const po =
|
|
3518
|
+
const po = parsePo(formatter2.serialize(catalog, ctx));
|
|
3509
3519
|
po.items = po.items.map((item) => {
|
|
3510
3520
|
const isGeneratedId = !item.extractedComments.includes(
|
|
3511
3521
|
"js-lingui-explicit-id"
|
|
@@ -3533,7 +3543,7 @@ function formatter(options = {}) {
|
|
|
3533
3543
|
});
|
|
3534
3544
|
po.items = newItems;
|
|
3535
3545
|
}
|
|
3536
|
-
return po
|
|
3546
|
+
return stringifyPo(po, serializeOptions);
|
|
3537
3547
|
}
|
|
3538
3548
|
};
|
|
3539
3549
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/format-po-gettext",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Gettext PO formatter for Lingui message catalogs using gettext-style plural rules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -41,19 +41,20 @@
|
|
|
41
41
|
"dist/"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lingui/conf": "6.0
|
|
45
|
-
"@lingui/format-po": "6.0
|
|
46
|
-
"@lingui/message-utils": "6.0
|
|
44
|
+
"@lingui/conf": "6.2.0",
|
|
45
|
+
"@lingui/format-po": "6.2.0",
|
|
46
|
+
"@lingui/message-utils": "6.2.0",
|
|
47
47
|
"@messageformat/parser": "^5.0.0",
|
|
48
|
-
"pofile": "^
|
|
48
|
+
"pofile-ts": "^4.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@lingui/test-utils": "3.0.3",
|
|
52
|
+
"typescript": "catalog:",
|
|
52
53
|
"unbuild": "catalog:",
|
|
53
54
|
"vitest": "catalog:"
|
|
54
55
|
},
|
|
55
56
|
"unbuild": {
|
|
56
57
|
"declaration": "node16"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "9f2a37bc4a9e3de323b4b9094898e8f05cf05956"
|
|
59
60
|
}
|