@lingui/format-po-gettext 4.0.0-next.2 → 4.0.0-next.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017-2022 Tomáš Ehrlich, (c) 2022-2023 Crowdin.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -152,13 +152,13 @@ function formatter(options = {}) {
152
152
  return {
153
153
  catalogExtension: ".po",
154
154
  templateExtension: ".pot",
155
- parse(content) {
155
+ parse(content, ctx) {
156
156
  const po = PO.parse(content);
157
157
  let pluralForms = getPluralCases(po.headers.Language);
158
158
  po.items.forEach((item) => {
159
159
  convertPluralsToICU(item, pluralForms, po.headers.Language);
160
160
  });
161
- return formatter2.parse(po.toString());
161
+ return formatter2.parse(po.toString(), ctx);
162
162
  },
163
163
  serialize(catalog, ctx) {
164
164
  const po = PO.parse(formatter2.serialize(catalog, ctx));
@@ -1,17 +1,9 @@
1
- import { CatalogType } from '@lingui/conf';
1
+ import { CatalogFormatter } from '@lingui/conf';
2
2
  import { PoFormatterOptions } from '@lingui/format-po';
3
3
 
4
4
  type PoGettextFormatterOptions = PoFormatterOptions & {
5
5
  disableSelectWarning?: boolean;
6
6
  };
7
- declare function formatter(options?: PoGettextFormatterOptions): {
8
- catalogExtension: string;
9
- templateExtension: string;
10
- parse(content: string): CatalogType;
11
- serialize(catalog: CatalogType, ctx: {
12
- locale: string;
13
- existing: string;
14
- }): string;
15
- };
7
+ declare function formatter(options?: PoGettextFormatterOptions): CatalogFormatter;
16
8
 
17
9
  export { PoGettextFormatterOptions, formatter };
@@ -150,13 +150,13 @@ function formatter(options = {}) {
150
150
  return {
151
151
  catalogExtension: ".po",
152
152
  templateExtension: ".pot",
153
- parse(content) {
153
+ parse(content, ctx) {
154
154
  const po = PO.parse(content);
155
155
  let pluralForms = getPluralCases(po.headers.Language);
156
156
  po.items.forEach((item) => {
157
157
  convertPluralsToICU(item, pluralForms, po.headers.Language);
158
158
  });
159
- return formatter2.parse(po.toString());
159
+ return formatter2.parse(po.toString(), ctx);
160
160
  },
161
161
  serialize(catalog, ctx) {
162
162
  const po = PO.parse(formatter2.serialize(catalog, ctx));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/format-po-gettext",
3
- "version": "4.0.0-next.2",
3
+ "version": "4.0.0-next.4",
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",
@@ -39,16 +39,19 @@
39
39
  "dist/"
40
40
  ],
41
41
  "dependencies": {
42
- "@lingui/cli": "4.0.0-next.2",
43
- "@lingui/conf": "4.0.0-next.2",
44
- "@lingui/format-po": "4.0.0-next.2",
42
+ "@lingui/cli": "^4.0.0-next.4",
43
+ "@lingui/conf": "^4.0.0-next.4",
44
+ "@lingui/format-po": "^4.0.0-next.4",
45
45
  "@messageformat/parser": "^5.0.0",
46
46
  "node-gettext": "^3.0.0",
47
47
  "plurals-cldr": "^2.0.1",
48
48
  "pofile": "^1.1.4"
49
49
  },
50
50
  "devDependencies": {
51
- "@lingui/jest-mocks": "workspace:^",
51
+ "@lingui/jest-mocks": "^3.0.3",
52
+ "mockdate": "^3.0.5",
53
+ "tsd": "^0.28.0",
52
54
  "unbuild": "^1.1.2"
53
- }
55
+ },
56
+ "gitHead": "3b999e35d26e67dec7cf0591f794be782e11022c"
54
57
  }