@lingui/format-po-gettext 4.4.2 → 4.5.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.
@@ -7,6 +7,12 @@ const gettextPlurals = require('node-gettext/lib/plurals');
7
7
  const generateMessageId = require('@lingui/message-utils/generateMessageId');
8
8
  const formatPo = require('@lingui/format-po');
9
9
 
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const pluralsCldr__default = /*#__PURE__*/_interopDefaultCompat(pluralsCldr);
13
+ const PO__default = /*#__PURE__*/_interopDefaultCompat(PO);
14
+ const gettextPlurals__default = /*#__PURE__*/_interopDefaultCompat(gettextPlurals);
15
+
10
16
  function stringifyICUCase(icuCase) {
11
17
  return icuCase.tokens.map((token) => {
12
18
  if (token.type === "content") {
@@ -85,9 +91,9 @@ function serializePlurals(item, message, id, isGeneratedId, options) {
85
91
  }
86
92
  const getPluralCases = (lang) => {
87
93
  const [correctLang] = lang.split(/[-_]/g);
88
- const gettextPluralsInfo = gettextPlurals[correctLang];
94
+ const gettextPluralsInfo = gettextPlurals__default[correctLang];
89
95
  return gettextPluralsInfo?.examples.map(
90
- (pluralCase) => pluralsCldr(correctLang, pluralCase.sample)
96
+ (pluralCase) => pluralsCldr__default(correctLang, pluralCase.sample)
91
97
  );
92
98
  };
93
99
  const convertPluralsToICU = (item, pluralForms, lang) => {
@@ -153,7 +159,7 @@ function formatter(options = {}) {
153
159
  catalogExtension: ".po",
154
160
  templateExtension: ".pot",
155
161
  parse(content, ctx) {
156
- const po = PO.parse(content);
162
+ const po = PO__default.parse(content);
157
163
  let pluralForms = getPluralCases(po.headers.Language);
158
164
  po.items.forEach((item) => {
159
165
  convertPluralsToICU(item, pluralForms, po.headers.Language);
@@ -161,7 +167,7 @@ function formatter(options = {}) {
161
167
  return formatter2.parse(po.toString(), ctx);
162
168
  },
163
169
  serialize(catalog, ctx) {
164
- const po = PO.parse(formatter2.serialize(catalog, ctx));
170
+ const po = PO__default.parse(formatter2.serialize(catalog, ctx));
165
171
  po.items = po.items.map((item) => {
166
172
  const isGeneratedId = !item.extractedComments.includes(
167
173
  "js-lingui-explicit-id"
@@ -0,0 +1,9 @@
1
+ import { CatalogFormatter } from '@lingui/conf';
2
+ import { PoFormatterOptions } from '@lingui/format-po';
3
+
4
+ type PoGettextFormatterOptions = PoFormatterOptions & {
5
+ disableSelectWarning?: boolean;
6
+ };
7
+ declare function formatter(options?: PoGettextFormatterOptions): CatalogFormatter;
8
+
9
+ export { type PoGettextFormatterOptions, formatter };
@@ -0,0 +1,9 @@
1
+ import { CatalogFormatter } from '@lingui/conf';
2
+ import { PoFormatterOptions } from '@lingui/format-po';
3
+
4
+ type PoGettextFormatterOptions = PoFormatterOptions & {
5
+ disableSelectWarning?: boolean;
6
+ };
7
+ declare function formatter(options?: PoGettextFormatterOptions): CatalogFormatter;
8
+
9
+ export { type PoGettextFormatterOptions, formatter };
@@ -6,4 +6,4 @@ type PoGettextFormatterOptions = PoFormatterOptions & {
6
6
  };
7
7
  declare function formatter(options?: PoGettextFormatterOptions): CatalogFormatter;
8
8
 
9
- export { PoGettextFormatterOptions, formatter };
9
+ export { type PoGettextFormatterOptions, formatter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/format-po-gettext",
3
- "version": "4.4.2",
3
+ "version": "4.5.0",
4
4
  "description": "Gettext PO format with gettext-style plurals for Lingui Catalogs",
5
5
  "main": "./dist/po-gettext.cjs",
6
6
  "module": "./dist/po-gettext.mjs",
@@ -41,9 +41,9 @@
41
41
  "dist/"
42
42
  ],
43
43
  "dependencies": {
44
- "@lingui/conf": "4.4.2",
45
- "@lingui/format-po": "4.4.2",
46
- "@lingui/message-utils": "4.4.2",
44
+ "@lingui/conf": "4.5.0",
45
+ "@lingui/format-po": "4.5.0",
46
+ "@lingui/message-utils": "4.5.0",
47
47
  "@messageformat/parser": "^5.0.0",
48
48
  "node-gettext": "^3.0.0",
49
49
  "plurals-cldr": "^2.0.1",
@@ -53,7 +53,7 @@
53
53
  "@lingui/jest-mocks": "^3.0.3",
54
54
  "mockdate": "^3.0.5",
55
55
  "tsd": "^0.28.0",
56
- "unbuild": "^1.1.2"
56
+ "unbuild": "2.0.0"
57
57
  },
58
- "gitHead": "316a004ec82721fcceb8f3c4a5aeb4a48d367927"
58
+ "gitHead": "62c92d1f8c60b3890bdda870f307fa780d423080"
59
59
  }