locize-cli 7.9.1 → 7.10.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/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  Project versioning adheres to [Semantic Versioning](http://semver.org/).
6
6
  Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
7
7
 
8
+ ## [7.10.0](https://github.com/locize/locize-cli/compare/v7.9.1...v7.10.0) - 2022-03-15
9
+
10
+ - gettext_i18next: try to detect v4 format
11
+
8
12
  ## [7.9.1](https://github.com/locize/locize-cli/compare/v7.9.0...v7.9.1) - 2022-03-02
9
13
 
10
14
  - xliff: fix combined plural keys
@@ -56,11 +56,13 @@ const convertToDesiredFormat = (
56
56
  }
57
57
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
58
58
  const flatData = flatten(data);
59
+ const compatibilityJSON = !!Object.keys(flatData).find((k) => /_(zero|one|two|few|many|other)/.test(k)) && 'v4';
59
60
  const gettextOpt = {
60
61
  project: 'locize',
61
62
  language: lng,
62
63
  potCreationDate: lastModified,
63
- poRevisionDate: lastModified
64
+ poRevisionDate: lastModified,
65
+ compatibilityJSON
64
66
  };
65
67
  cb(null, i18next2po(lng, flatData, gettextOpt));
66
68
  return;
@@ -40,7 +40,9 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
40
40
  }
41
41
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
42
42
  try {
43
- const ret = po2i18next(data.toString());
43
+ const potxt = data.toString();
44
+ const compatibilityJSON = /msgctxt "(zero|one|two|few|many|other)"/.test(potxt) && 'v4';
45
+ const ret = po2i18next(potxt, { compatibilityJSON });
44
46
  cb(null, flatten(ret));
45
47
  } catch (err) {
46
48
  cb(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "7.9.1",
3
+ "version": "7.10.0",
4
4
  "description": "locize cli to import locales",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "diff": "5.0.0",
17
17
  "flat": "5.0.2",
18
18
  "fluent_conv": "3.1.0",
19
- "gettext-converter": "1.2.0",
19
+ "gettext-converter": "1.2.2",
20
20
  "https-proxy-agent": "5.0.0",
21
21
  "ini": "2.0.0",
22
22
  "js-yaml": "4.1.0",
@@ -29,11 +29,11 @@
29
29
  "strings-file": "0.0.5",
30
30
  "tmexchange": "2.0.4",
31
31
  "xliff": "6.0.3",
32
- "xlsx": "0.18.2"
32
+ "xlsx": "0.18.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "eslint": "7.32.0",
36
- "gh-release": "6.0.1",
36
+ "gh-release": "6.0.2",
37
37
  "pkg": "5.5.2"
38
38
  },
39
39
  "scripts": {