@lingui/format-po 4.10.0 → 4.11.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/README.md +7 -0
- package/dist/po.cjs +7 -3
- package/dist/po.d.cts +8 -0
- package/dist/po.d.mts +8 -0
- package/dist/po.d.ts +8 -0
- package/dist/po.mjs +7 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -76,6 +76,13 @@ export type PoFormatterOptions = {
|
|
|
76
76
|
* @default false
|
|
77
77
|
*/
|
|
78
78
|
explicitIdAsDefault?: boolean
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Custom attributes to append to the PO file header
|
|
82
|
+
*
|
|
83
|
+
* @default {}
|
|
84
|
+
*/
|
|
85
|
+
customHeaderAttributes?: { [key: string]: string }
|
|
79
86
|
}
|
|
80
87
|
```
|
|
81
88
|
|
package/dist/po.cjs
CHANGED
|
@@ -16,14 +16,15 @@ const joinOrigin = (origin) => origin.join(":");
|
|
|
16
16
|
function isGeneratedId(id, message) {
|
|
17
17
|
return id === generateMessageId.generateMessageId(message.message, message.context);
|
|
18
18
|
}
|
|
19
|
-
function getCreateHeaders(language) {
|
|
19
|
+
function getCreateHeaders(language, customHeaderAttributes) {
|
|
20
20
|
return {
|
|
21
21
|
"POT-Creation-Date": dateFns.format(/* @__PURE__ */ new Date(), "yyyy-MM-dd HH:mmxxxx"),
|
|
22
22
|
"MIME-Version": "1.0",
|
|
23
23
|
"Content-Type": "text/plain; charset=utf-8",
|
|
24
24
|
"Content-Transfer-Encoding": "8bit",
|
|
25
25
|
"X-Generator": "@lingui/cli",
|
|
26
|
-
...language ? { Language: language } : {}
|
|
26
|
+
...language ? { Language: language } : {},
|
|
27
|
+
...customHeaderAttributes ?? {}
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
const EXPLICIT_ID_FLAG = "js-lingui-explicit-id";
|
|
@@ -115,7 +116,10 @@ function formatter(options = {}) {
|
|
|
115
116
|
po = PO__default.parse(ctx.existing);
|
|
116
117
|
} else {
|
|
117
118
|
po = new PO__default();
|
|
118
|
-
po.headers = getCreateHeaders(
|
|
119
|
+
po.headers = getCreateHeaders(
|
|
120
|
+
ctx.locale,
|
|
121
|
+
options.customHeaderAttributes
|
|
122
|
+
);
|
|
119
123
|
po.headerOrder = Object.keys(po.headers);
|
|
120
124
|
}
|
|
121
125
|
po.items = serialize(catalog, options);
|
package/dist/po.d.cts
CHANGED
|
@@ -33,6 +33,14 @@ type PoFormatterOptions = {
|
|
|
33
33
|
* @default false
|
|
34
34
|
*/
|
|
35
35
|
explicitIdAsDefault?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Custom attributes to append to the PO file header
|
|
38
|
+
*
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
customHeaderAttributes?: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
36
44
|
};
|
|
37
45
|
declare function formatter(options?: PoFormatterOptions): CatalogFormatter;
|
|
38
46
|
|
package/dist/po.d.mts
CHANGED
|
@@ -33,6 +33,14 @@ type PoFormatterOptions = {
|
|
|
33
33
|
* @default false
|
|
34
34
|
*/
|
|
35
35
|
explicitIdAsDefault?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Custom attributes to append to the PO file header
|
|
38
|
+
*
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
customHeaderAttributes?: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
36
44
|
};
|
|
37
45
|
declare function formatter(options?: PoFormatterOptions): CatalogFormatter;
|
|
38
46
|
|
package/dist/po.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ type PoFormatterOptions = {
|
|
|
33
33
|
* @default false
|
|
34
34
|
*/
|
|
35
35
|
explicitIdAsDefault?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Custom attributes to append to the PO file header
|
|
38
|
+
*
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
customHeaderAttributes?: {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
};
|
|
36
44
|
};
|
|
37
45
|
declare function formatter(options?: PoFormatterOptions): CatalogFormatter;
|
|
38
46
|
|
package/dist/po.mjs
CHANGED
|
@@ -10,14 +10,15 @@ const joinOrigin = (origin) => origin.join(":");
|
|
|
10
10
|
function isGeneratedId(id, message) {
|
|
11
11
|
return id === generateMessageId(message.message, message.context);
|
|
12
12
|
}
|
|
13
|
-
function getCreateHeaders(language) {
|
|
13
|
+
function getCreateHeaders(language, customHeaderAttributes) {
|
|
14
14
|
return {
|
|
15
15
|
"POT-Creation-Date": format(/* @__PURE__ */ new Date(), "yyyy-MM-dd HH:mmxxxx"),
|
|
16
16
|
"MIME-Version": "1.0",
|
|
17
17
|
"Content-Type": "text/plain; charset=utf-8",
|
|
18
18
|
"Content-Transfer-Encoding": "8bit",
|
|
19
19
|
"X-Generator": "@lingui/cli",
|
|
20
|
-
...language ? { Language: language } : {}
|
|
20
|
+
...language ? { Language: language } : {},
|
|
21
|
+
...customHeaderAttributes ?? {}
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
const EXPLICIT_ID_FLAG = "js-lingui-explicit-id";
|
|
@@ -109,7 +110,10 @@ function formatter(options = {}) {
|
|
|
109
110
|
po = PO.parse(ctx.existing);
|
|
110
111
|
} else {
|
|
111
112
|
po = new PO();
|
|
112
|
-
po.headers = getCreateHeaders(
|
|
113
|
+
po.headers = getCreateHeaders(
|
|
114
|
+
ctx.locale,
|
|
115
|
+
options.customHeaderAttributes
|
|
116
|
+
);
|
|
113
117
|
po.headerOrder = Object.keys(po.headers);
|
|
114
118
|
}
|
|
115
119
|
po.items = serialize(catalog, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/format-po",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Gettext PO format for Lingui Catalogs",
|
|
5
5
|
"main": "./dist/po.cjs",
|
|
6
6
|
"module": "./dist/po.mjs",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dist/"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lingui/conf": "4.
|
|
45
|
-
"@lingui/message-utils": "4.
|
|
44
|
+
"@lingui/conf": "4.11.0",
|
|
45
|
+
"@lingui/message-utils": "4.11.0",
|
|
46
46
|
"date-fns": "^3.6.0",
|
|
47
47
|
"pofile": "^1.1.4"
|
|
48
48
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"tsd": "^0.28.0",
|
|
53
53
|
"unbuild": "2.0.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "8668ba8ef405d99d496949ff9681247deb97063d"
|
|
56
56
|
}
|