locize-cli 12.0.1 → 12.0.2

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
+ ## [12.0.2](https://github.com/locize/locize-cli/compare/v12.0.1...v12.0.2) - 2026-01-13
9
+
10
+ - fix binary packaging
11
+
8
12
  ## [12.0.1](https://github.com/locize/locize-cli/compare/v12.0.0...v12.0.1) - 2026-01-13
9
13
 
10
14
  - update dependencies
package/dist/cjs/cli.js CHANGED
@@ -50,7 +50,7 @@ const program = new commander.Command();
50
50
 
51
51
  program
52
52
  .description('The official locize CLI.')
53
- .version('12.0.1'); // This string is replaced with the actual version at build time by rollup
53
+ .version('12.0.2'); // This string is replaced with the actual version at build time by rollup
54
54
  // .option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
55
55
  // .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`);
56
56
 
@@ -1,18 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var flatten = require('flat');
4
- var i18next2po = require('gettext-converter/i18next2po');
4
+ var gettextConv = require('gettext-converter');
5
5
  var csv = require('fast-csv');
6
6
  var xlsx = require('xlsx');
7
7
  var yaml = require('yaml');
8
- var js2asr = require('android-string-resource/js2asr');
8
+ var asr = require('android-string-resource');
9
9
  var stringsFile = require('strings-file');
10
- var createxliff = require('xliff/createxliff');
11
- var createxliff12 = require('xliff/createxliff12');
12
- var js2resx = require('resx/js2resx');
13
- var js2ftl = require('fluent_conv/js2ftl');
14
- var js2tmx = require('tmexchange/js2tmx');
15
- var js2laravel = require('laravelphp/js2laravel');
10
+ var xliff = require('xliff');
11
+ var resx = require('resx');
12
+ var fluentConv = require('fluent_conv');
13
+ var tmexchange = require('tmexchange');
14
+ var laravelphp = require('laravelphp');
16
15
  var javaProperties = require('@js.properties/properties');
17
16
  var unflatten = require('./unflatten.js');
18
17
  var getRemoteNamespace = require('./getRemoteNamespace.js');
@@ -54,7 +53,7 @@ const convertToDesiredFormat = async (
54
53
  ctxSeparator: '_ is default but we set it to something that is never found!!!',
55
54
  persistMsgIdPlural: true
56
55
  };
57
- return i18next2po(lng, flatData, gettextOpt)
56
+ return gettextConv.i18next2po(lng, flatData, gettextOpt)
58
57
  }
59
58
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
60
59
  const flatData = flatten(data);
@@ -66,7 +65,7 @@ const convertToDesiredFormat = async (
66
65
  poRevisionDate: lastModified,
67
66
  compatibilityJSON
68
67
  };
69
- return i18next2po(lng, flatData, gettextOpt)
68
+ return gettextConv.i18next2po(lng, flatData, gettextOpt)
70
69
  }
71
70
  if (opt.format === 'csv') {
72
71
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
@@ -136,7 +135,7 @@ const convertToDesiredFormat = async (
136
135
  return yaml.stringify(removeUndefinedFromArrays(newDataNs))
137
136
  }
138
137
  if (opt.format === 'android') {
139
- return await js2asr(flatten(data))
138
+ return await asr.js2asr(flatten(data))
140
139
  }
141
140
  if (opt.format === 'strings') {
142
141
  Object.keys(data).forEach((k) => {
@@ -152,14 +151,14 @@ const convertToDesiredFormat = async (
152
151
  ) {
153
152
  const fn =
154
153
  opt.format === 'xliff12' || opt.format === 'xlf12'
155
- ? createxliff12
156
- : createxliff;
154
+ ? xliff.createxliff12
155
+ : xliff.createxliff;
157
156
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
158
157
  const prepared = combineSubkeyPreprocessor.prepareExport(refNs, flatten(data));
159
158
  return await fn(opt.referenceLanguage, lng, prepared.ref, prepared.trg, namespace)
160
159
  }
161
160
  if (opt.format === 'resx') {
162
- return await js2resx(flatten(data))
161
+ return await resx.js2resx(flatten(data))
163
162
  }
164
163
  if (opt.format === 'fluent') {
165
164
  Object.keys(data).forEach((k) => {
@@ -169,7 +168,7 @@ const convertToDesiredFormat = async (
169
168
  String.fromCharCode(32)
170
169
  );
171
170
  });
172
- return js2ftl(unflatten(data))
171
+ return fluentConv.js2ftl(unflatten(data))
173
172
  }
174
173
  if (opt.format === 'tmx') {
175
174
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
@@ -191,10 +190,10 @@ const convertToDesiredFormat = async (
191
190
  sourceLanguage: opt.referenceLanguage
192
191
  }
193
192
  );
194
- return await js2tmx(js2TmxData)
193
+ return await tmexchange.js2tmx(js2TmxData)
195
194
  }
196
195
  if (opt.format === 'laravel') {
197
- return await js2laravel(unflatten(data))
196
+ return await laravelphp.js2laravel(unflatten(data))
198
197
  }
199
198
  if (opt.format === 'properties') {
200
199
  return javaProperties.stringifyFromProperties(data, { eol: '\n' })
@@ -1,21 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var po2i18next = require('gettext-converter/po2i18next');
3
+ var gettextConv = require('gettext-converter');
4
4
  var csv = require('fast-csv');
5
5
  var xlsx = require('xlsx');
6
6
  var yaml = require('yaml');
7
- var asr2js = require('android-string-resource/asr2js');
7
+ var asr = require('android-string-resource');
8
8
  var stringsFile = require('strings-file');
9
- var xliff2js = require('xliff/xliff2js');
10
- var xliff12ToJs = require('xliff/xliff12ToJs');
11
- var targetOfjs = require('xliff/targetOfjs');
12
- var sourceOfjs = require('xliff/sourceOfjs');
13
- var resx2js = require('resx/resx2js');
14
- var ftl2js = require('fluent_conv/ftl2js');
15
- var tmx2js = require('tmexchange/tmx2js');
16
- var laravel2js = require('laravelphp/laravel2js');
9
+ var xliff = require('xliff');
10
+ var resx = require('resx');
11
+ var fluentConv = require('fluent_conv');
12
+ var tmexchange = require('tmexchange');
13
+ var laravelphp = require('laravelphp');
17
14
  var javaProperties = require('@js.properties/properties');
18
- var xcstrings2locize = require('locize-xcstrings/xcstrings2locize');
15
+ var xcstrings = require('locize-xcstrings');
19
16
  var flatten = require('flat');
20
17
  var combineSubkeyPreprocessor = require('./combineSubkeyPreprocessor.js');
21
18
 
@@ -30,7 +27,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
30
27
  return flatten(jsonParsed)
31
28
  }
32
29
  if (opt.format === 'po' || opt.format === 'gettext') {
33
- const ret = po2i18next(data.toString(), {
30
+ const ret = gettextConv.po2i18next(data.toString(), {
34
31
  persistMsgIdPlural: true,
35
32
  ignoreCtx: true
36
33
  });
@@ -39,7 +36,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
39
36
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
40
37
  const potxt = data.toString();
41
38
  const compatibilityJSON = /msgctxt "(zero|one|two|few|many|other)"/.test(potxt) && 'v4';
42
- const ret = po2i18next(potxt, { compatibilityJSON });
39
+ const ret = gettextConv.po2i18next(potxt, { compatibilityJSON });
43
40
  return flatten(ret)
44
41
  }
45
42
  if (opt.format === 'csv') {
@@ -100,7 +97,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
100
97
  return flatten(jsObjn[Object.keys(jsObjn)[0]][Object.keys(jsObjn[Object.keys(jsObjn)[0]])[0]])
101
98
  }
102
99
  if (opt.format === 'android') {
103
- const res = await asr2js(data.toString(), { comment: 'right' });
100
+ const res = await asr.asr2js(data.toString(), { comment: 'right' });
104
101
  Object.keys(res).forEach((k) => {
105
102
  if (res[k] !== 'string' && typeof res[k].comment === 'string') {
106
103
  res[k] = {
@@ -127,8 +124,8 @@ const convertToFlatFormat = async (opt, data, lng) => {
127
124
  ) {
128
125
  const fn =
129
126
  opt.format === 'xliff12' || opt.format === 'xlf12'
130
- ? xliff12ToJs
131
- : xliff2js;
127
+ ? xliff.xliff12ToJs
128
+ : xliff.xliff2js;
132
129
  const res = await fn(data.toString());
133
130
  res.resources = res.resources || {};
134
131
  const ns = Object.keys(res.resources)[0];
@@ -147,22 +144,22 @@ const convertToFlatFormat = async (opt, data, lng) => {
147
144
  return combineSubkeyPreprocessor.prepareImport(nsRes)
148
145
  }
149
146
  if (!res.targetLanguage) {
150
- const ret = await sourceOfjs(res);
147
+ const ret = await xliff.sourceOfjs(res);
151
148
  return checkForPostProcessing(ret)
152
149
  } else {
153
- let ret = targetOfjs(res);
150
+ let ret = xliff.targetOfjs(res);
154
151
  if (lng !== opt.referenceLanguage) return checkForPostProcessing(ret)
155
152
  ret = ret || {};
156
153
  const keys = Object.keys(ret);
157
154
  if (keys.length === 0) return checkForPostProcessing(ret)
158
155
  const allEmpty = keys.filter((k) => ret[k] !== '').length === 0;
159
156
  if (!allEmpty) return checkForPostProcessing(ret)
160
- ret = await sourceOfjs(res);
157
+ ret = await xliff.sourceOfjs(res);
161
158
  return checkForPostProcessing(ret)
162
159
  }
163
160
  }
164
161
  if (opt.format === 'resx') {
165
- let res = await resx2js(data.toString());
162
+ let res = await resx.resx2js(data.toString());
166
163
  res = Object.keys(res).reduce((mem, k) => {
167
164
  const value = res[k];
168
165
  if (typeof value === 'string') {
@@ -178,7 +175,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
178
175
  return res
179
176
  }
180
177
  if (opt.format === 'fluent') {
181
- const fluentJS = ftl2js(
178
+ const fluentJS = fluentConv.ftl2js(
182
179
  data
183
180
  .toString()
184
181
  .replace(
@@ -205,7 +202,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
205
202
  return res
206
203
  }
207
204
  if (opt.format === 'tmx') {
208
- const jsonData = await tmx2js(data.toString());
205
+ const jsonData = await tmexchange.tmx2js(data.toString());
209
206
  const tmxJsRes = jsonData.resources[Object.keys(jsonData.resources)[0]];
210
207
  const res = {};
211
208
  if (tmxJsRes) {
@@ -216,14 +213,14 @@ const convertToFlatFormat = async (opt, data, lng) => {
216
213
  return res
217
214
  }
218
215
  if (opt.format === 'laravel') {
219
- const res = await laravel2js(data.toString());
216
+ const res = await laravelphp.laravel2js(data.toString());
220
217
  return flatten(res)
221
218
  }
222
219
  if (opt.format === 'properties') {
223
220
  return javaProperties.parseToProperties(data.toString())
224
221
  }
225
222
  if (opt.format === 'xcstrings') {
226
- return xcstrings2locize(data.toString())
223
+ return xcstrings.xcstrings2locize(data.toString())
227
224
  }
228
225
  throw new Error(`${opt.format} is not a valid format!`)
229
226
  };
@@ -12,7 +12,7 @@ var getRemoteLanguages = require('./getRemoteLanguages.js');
12
12
  var convertToDesiredFormat = require('./convertToDesiredFormat.js');
13
13
  var formats = require('./formats.js');
14
14
  var getProjectStats = require('./getProjectStats.js');
15
- var locize2xcstrings = require('locize-xcstrings/locize2xcstrings');
15
+ var xcstrings = require('locize-xcstrings');
16
16
  var getBranches = require('./getBranches.js');
17
17
  var isValidUuid = require('./isValidUuid.js');
18
18
  var mapLimit = require('./mapLimit.js');
@@ -70,7 +70,7 @@ async function handleDownload (opt, url, err, res, downloads) {
70
70
  locizeData.resources[language] = nsData;
71
71
  });
72
72
  try {
73
- const converted = locize2xcstrings(locizeData);
73
+ const converted = xcstrings.locize2xcstrings(locizeData);
74
74
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, ns) + reversedFileExtensionsMap[opt.format];
75
75
  let mkdirPath;
76
76
  if (filledMask.lastIndexOf(path.sep) > 0) {
@@ -158,7 +158,7 @@ async function handlePull (opt, toDownload) {
158
158
  locizeData.resources[language] = nsData;
159
159
  });
160
160
  try {
161
- const result = locize2xcstrings(locizeData);
161
+ const result = xcstrings.locize2xcstrings(locizeData);
162
162
  const converted = JSON.stringify(result, null, 2);
163
163
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format];
164
164
  let mkdirPath;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "type": "commonjs"
5
5
  }
@@ -5,7 +5,7 @@ var path = require('node:path');
5
5
  var mkdirp = require('mkdirp');
6
6
  var convertToFlatFormat = require('./convertToFlatFormat.js');
7
7
  var formats = require('./formats.js');
8
- var xcstrings2locize = require('locize-xcstrings/xcstrings2locize');
8
+ var xcstrings = require('locize-xcstrings');
9
9
 
10
10
  const fileExtensionsMap = formats.fileExtensionsMap;
11
11
  const acceptedFileExtensions = formats.acceptedFileExtensions;
@@ -145,7 +145,7 @@ const parseLocalLanguage = async (opt, lng) => {
145
145
  }
146
146
  if (opt.format === 'xcstrings') {
147
147
  try {
148
- const content = xcstrings2locize(data);
148
+ const content = xcstrings.xcstrings2locize(data);
149
149
  const stat = await fs.promises.stat(fPath);
150
150
  return Object.keys(content.resources).map((l) => ({
151
151
  namespace,
@@ -38,7 +38,7 @@ async function request (url, options) {
38
38
  }
39
39
 
40
40
  options.headers = options.headers || {};
41
- options.headers['User-Agent'] = `locize-cli/v12.0.1 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
41
+ options.headers['User-Agent'] = `locize-cli/v12.0.2 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
42
42
  options.headers['X-User-Agent'] = options.headers['User-Agent'];
43
43
  if (options.body || options.method !== 'get') options.headers['Content-Type'] = 'application/json';
44
44
  if (options.body) {
package/dist/cjs/sync.js CHANGED
@@ -16,7 +16,7 @@ var parseLocalReference = require('./parseLocalReference.js');
16
16
  var formats = require('./formats.js');
17
17
  var deleteNamespace = require('./deleteNamespace.js');
18
18
  var getProjectStats = require('./getProjectStats.js');
19
- var locize2xcstrings = require('locize-xcstrings/locize2xcstrings');
19
+ var xcstrings = require('locize-xcstrings');
20
20
  var getBranches = require('./getBranches.js');
21
21
  var isValidUuid = require('./isValidUuid.js');
22
22
  var os = require('node:os');
@@ -354,7 +354,7 @@ async function downloadAll (opt, remoteLanguages, omitRef = false, manipulate) {
354
354
  });
355
355
 
356
356
  try {
357
- const converted = locize2xcstrings(locizeData);
357
+ const converted = xcstrings.locize2xcstrings(locizeData);
358
358
 
359
359
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format];
360
360
  if (opt.dry) return
package/dist/esm/cli.js CHANGED
@@ -48,7 +48,7 @@ const program = new Command();
48
48
 
49
49
  program
50
50
  .description('The official locize CLI.')
51
- .version('12.0.1'); // This string is replaced with the actual version at build time by rollup
51
+ .version('12.0.2'); // This string is replaced with the actual version at build time by rollup
52
52
  // .option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
53
53
  // .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`);
54
54
 
@@ -1,16 +1,15 @@
1
1
  import flatten from 'flat';
2
- import i18next2po from 'gettext-converter/i18next2po';
2
+ import gettextConv from 'gettext-converter';
3
3
  import csv from 'fast-csv';
4
4
  import xlsx from 'xlsx';
5
5
  import yaml from 'yaml';
6
- import js2asr from 'android-string-resource/js2asr';
6
+ import asr from 'android-string-resource';
7
7
  import stringsFile from 'strings-file';
8
- import createxliff from 'xliff/createxliff';
9
- import createxliff12 from 'xliff/createxliff12';
10
- import js2resx from 'resx/js2resx';
11
- import js2ftl from 'fluent_conv/js2ftl';
12
- import js2tmx from 'tmexchange/js2tmx';
13
- import js2laravel from 'laravelphp/js2laravel';
8
+ import xliff from 'xliff';
9
+ import resx from 'resx';
10
+ import fluentConv from 'fluent_conv';
11
+ import tmexchange from 'tmexchange';
12
+ import laravelphp from 'laravelphp';
14
13
  import javaProperties from '@js.properties/properties';
15
14
  import unflatten from './unflatten.js';
16
15
  import getRemoteNamespace from './getRemoteNamespace.js';
@@ -52,7 +51,7 @@ const convertToDesiredFormat = async (
52
51
  ctxSeparator: '_ is default but we set it to something that is never found!!!',
53
52
  persistMsgIdPlural: true
54
53
  };
55
- return i18next2po(lng, flatData, gettextOpt)
54
+ return gettextConv.i18next2po(lng, flatData, gettextOpt)
56
55
  }
57
56
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
58
57
  const flatData = flatten(data);
@@ -64,7 +63,7 @@ const convertToDesiredFormat = async (
64
63
  poRevisionDate: lastModified,
65
64
  compatibilityJSON
66
65
  };
67
- return i18next2po(lng, flatData, gettextOpt)
66
+ return gettextConv.i18next2po(lng, flatData, gettextOpt)
68
67
  }
69
68
  if (opt.format === 'csv') {
70
69
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
@@ -134,7 +133,7 @@ const convertToDesiredFormat = async (
134
133
  return yaml.stringify(removeUndefinedFromArrays(newDataNs))
135
134
  }
136
135
  if (opt.format === 'android') {
137
- return await js2asr(flatten(data))
136
+ return await asr.js2asr(flatten(data))
138
137
  }
139
138
  if (opt.format === 'strings') {
140
139
  Object.keys(data).forEach((k) => {
@@ -150,14 +149,14 @@ const convertToDesiredFormat = async (
150
149
  ) {
151
150
  const fn =
152
151
  opt.format === 'xliff12' || opt.format === 'xlf12'
153
- ? createxliff12
154
- : createxliff;
152
+ ? xliff.createxliff12
153
+ : xliff.createxliff;
155
154
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
156
155
  const prepared = prepareExport(refNs, flatten(data));
157
156
  return await fn(opt.referenceLanguage, lng, prepared.ref, prepared.trg, namespace)
158
157
  }
159
158
  if (opt.format === 'resx') {
160
- return await js2resx(flatten(data))
159
+ return await resx.js2resx(flatten(data))
161
160
  }
162
161
  if (opt.format === 'fluent') {
163
162
  Object.keys(data).forEach((k) => {
@@ -167,7 +166,7 @@ const convertToDesiredFormat = async (
167
166
  String.fromCharCode(32)
168
167
  );
169
168
  });
170
- return js2ftl(unflatten(data))
169
+ return fluentConv.js2ftl(unflatten(data))
171
170
  }
172
171
  if (opt.format === 'tmx') {
173
172
  const refNs = await opt.getNamespace(opt, opt.referenceLanguage, namespace);
@@ -189,10 +188,10 @@ const convertToDesiredFormat = async (
189
188
  sourceLanguage: opt.referenceLanguage
190
189
  }
191
190
  );
192
- return await js2tmx(js2TmxData)
191
+ return await tmexchange.js2tmx(js2TmxData)
193
192
  }
194
193
  if (opt.format === 'laravel') {
195
- return await js2laravel(unflatten(data))
194
+ return await laravelphp.js2laravel(unflatten(data))
196
195
  }
197
196
  if (opt.format === 'properties') {
198
197
  return javaProperties.stringifyFromProperties(data, { eol: '\n' })
@@ -1,19 +1,16 @@
1
- import po2i18next from 'gettext-converter/po2i18next';
1
+ import gettextConv from 'gettext-converter';
2
2
  import csv from 'fast-csv';
3
3
  import xlsx from 'xlsx';
4
4
  import yaml from 'yaml';
5
- import asr2js from 'android-string-resource/asr2js';
5
+ import asr from 'android-string-resource';
6
6
  import stringsFile from 'strings-file';
7
- import xliff2js from 'xliff/xliff2js';
8
- import xliff12ToJs from 'xliff/xliff12ToJs';
9
- import targetOfjs from 'xliff/targetOfjs';
10
- import sourceOfjs from 'xliff/sourceOfjs';
11
- import resx2js from 'resx/resx2js';
12
- import ftl2js from 'fluent_conv/ftl2js';
13
- import tmx2js from 'tmexchange/tmx2js';
14
- import laravel2js from 'laravelphp/laravel2js';
7
+ import xliff from 'xliff';
8
+ import resx from 'resx';
9
+ import fluentConv from 'fluent_conv';
10
+ import tmexchange from 'tmexchange';
11
+ import laravelphp from 'laravelphp';
15
12
  import javaProperties from '@js.properties/properties';
16
- import xcstrings2locize from 'locize-xcstrings/xcstrings2locize';
13
+ import xcstrings from 'locize-xcstrings';
17
14
  import flatten from 'flat';
18
15
  import { prepareImport } from './combineSubkeyPreprocessor.js';
19
16
 
@@ -28,7 +25,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
28
25
  return flatten(jsonParsed)
29
26
  }
30
27
  if (opt.format === 'po' || opt.format === 'gettext') {
31
- const ret = po2i18next(data.toString(), {
28
+ const ret = gettextConv.po2i18next(data.toString(), {
32
29
  persistMsgIdPlural: true,
33
30
  ignoreCtx: true
34
31
  });
@@ -37,7 +34,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
37
34
  if (opt.format === 'po_i18next' || opt.format === 'gettext_i18next') {
38
35
  const potxt = data.toString();
39
36
  const compatibilityJSON = /msgctxt "(zero|one|two|few|many|other)"/.test(potxt) && 'v4';
40
- const ret = po2i18next(potxt, { compatibilityJSON });
37
+ const ret = gettextConv.po2i18next(potxt, { compatibilityJSON });
41
38
  return flatten(ret)
42
39
  }
43
40
  if (opt.format === 'csv') {
@@ -98,7 +95,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
98
95
  return flatten(jsObjn[Object.keys(jsObjn)[0]][Object.keys(jsObjn[Object.keys(jsObjn)[0]])[0]])
99
96
  }
100
97
  if (opt.format === 'android') {
101
- const res = await asr2js(data.toString(), { comment: 'right' });
98
+ const res = await asr.asr2js(data.toString(), { comment: 'right' });
102
99
  Object.keys(res).forEach((k) => {
103
100
  if (res[k] !== 'string' && typeof res[k].comment === 'string') {
104
101
  res[k] = {
@@ -125,8 +122,8 @@ const convertToFlatFormat = async (opt, data, lng) => {
125
122
  ) {
126
123
  const fn =
127
124
  opt.format === 'xliff12' || opt.format === 'xlf12'
128
- ? xliff12ToJs
129
- : xliff2js;
125
+ ? xliff.xliff12ToJs
126
+ : xliff.xliff2js;
130
127
  const res = await fn(data.toString());
131
128
  res.resources = res.resources || {};
132
129
  const ns = Object.keys(res.resources)[0];
@@ -145,22 +142,22 @@ const convertToFlatFormat = async (opt, data, lng) => {
145
142
  return prepareImport(nsRes)
146
143
  }
147
144
  if (!res.targetLanguage) {
148
- const ret = await sourceOfjs(res);
145
+ const ret = await xliff.sourceOfjs(res);
149
146
  return checkForPostProcessing(ret)
150
147
  } else {
151
- let ret = targetOfjs(res);
148
+ let ret = xliff.targetOfjs(res);
152
149
  if (lng !== opt.referenceLanguage) return checkForPostProcessing(ret)
153
150
  ret = ret || {};
154
151
  const keys = Object.keys(ret);
155
152
  if (keys.length === 0) return checkForPostProcessing(ret)
156
153
  const allEmpty = keys.filter((k) => ret[k] !== '').length === 0;
157
154
  if (!allEmpty) return checkForPostProcessing(ret)
158
- ret = await sourceOfjs(res);
155
+ ret = await xliff.sourceOfjs(res);
159
156
  return checkForPostProcessing(ret)
160
157
  }
161
158
  }
162
159
  if (opt.format === 'resx') {
163
- let res = await resx2js(data.toString());
160
+ let res = await resx.resx2js(data.toString());
164
161
  res = Object.keys(res).reduce((mem, k) => {
165
162
  const value = res[k];
166
163
  if (typeof value === 'string') {
@@ -176,7 +173,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
176
173
  return res
177
174
  }
178
175
  if (opt.format === 'fluent') {
179
- const fluentJS = ftl2js(
176
+ const fluentJS = fluentConv.ftl2js(
180
177
  data
181
178
  .toString()
182
179
  .replace(
@@ -203,7 +200,7 @@ const convertToFlatFormat = async (opt, data, lng) => {
203
200
  return res
204
201
  }
205
202
  if (opt.format === 'tmx') {
206
- const jsonData = await tmx2js(data.toString());
203
+ const jsonData = await tmexchange.tmx2js(data.toString());
207
204
  const tmxJsRes = jsonData.resources[Object.keys(jsonData.resources)[0]];
208
205
  const res = {};
209
206
  if (tmxJsRes) {
@@ -214,14 +211,14 @@ const convertToFlatFormat = async (opt, data, lng) => {
214
211
  return res
215
212
  }
216
213
  if (opt.format === 'laravel') {
217
- const res = await laravel2js(data.toString());
214
+ const res = await laravelphp.laravel2js(data.toString());
218
215
  return flatten(res)
219
216
  }
220
217
  if (opt.format === 'properties') {
221
218
  return javaProperties.parseToProperties(data.toString())
222
219
  }
223
220
  if (opt.format === 'xcstrings') {
224
- return xcstrings2locize(data.toString())
221
+ return xcstrings.xcstrings2locize(data.toString())
225
222
  }
226
223
  throw new Error(`${opt.format} is not a valid format!`)
227
224
  };
@@ -10,7 +10,7 @@ import getRemoteLanguages from './getRemoteLanguages.js';
10
10
  import convertToDesiredFormat from './convertToDesiredFormat.js';
11
11
  import { reversedFileExtensionsMap as reversedFileExtensionsMap$1 } from './formats.js';
12
12
  import getProjectStats from './getProjectStats.js';
13
- import locize2xcstrings from 'locize-xcstrings/locize2xcstrings';
13
+ import xcstrings from 'locize-xcstrings';
14
14
  import getBranches from './getBranches.js';
15
15
  import isValidUuid from './isValidUuid.js';
16
16
  import mapLimit from './mapLimit.js';
@@ -68,7 +68,7 @@ async function handleDownload (opt, url, err, res, downloads) {
68
68
  locizeData.resources[language] = nsData;
69
69
  });
70
70
  try {
71
- const converted = locize2xcstrings(locizeData);
71
+ const converted = xcstrings.locize2xcstrings(locizeData);
72
72
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, ns) + reversedFileExtensionsMap[opt.format];
73
73
  let mkdirPath;
74
74
  if (filledMask.lastIndexOf(path.sep) > 0) {
@@ -156,7 +156,7 @@ async function handlePull (opt, toDownload) {
156
156
  locizeData.resources[language] = nsData;
157
157
  });
158
158
  try {
159
- const result = locize2xcstrings(locizeData);
159
+ const result = xcstrings.locize2xcstrings(locizeData);
160
160
  const converted = JSON.stringify(result, null, 2);
161
161
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format];
162
162
  let mkdirPath;
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import { mkdirp } from 'mkdirp';
4
4
  import convertToFlatFormat from './convertToFlatFormat.js';
5
5
  import { fileExtensionsMap as fileExtensionsMap$1, acceptedFileExtensions as acceptedFileExtensions$1 } from './formats.js';
6
- import xcstrings2locize from 'locize-xcstrings/xcstrings2locize';
6
+ import xcstrings from 'locize-xcstrings';
7
7
 
8
8
  const fileExtensionsMap = fileExtensionsMap$1;
9
9
  const acceptedFileExtensions = acceptedFileExtensions$1;
@@ -143,7 +143,7 @@ const parseLocalLanguage = async (opt, lng) => {
143
143
  }
144
144
  if (opt.format === 'xcstrings') {
145
145
  try {
146
- const content = xcstrings2locize(data);
146
+ const content = xcstrings.xcstrings2locize(data);
147
147
  const stat = await fs.promises.stat(fPath);
148
148
  return Object.keys(content.resources).map((l) => ({
149
149
  namespace,
@@ -36,7 +36,7 @@ async function request (url, options) {
36
36
  }
37
37
 
38
38
  options.headers = options.headers || {};
39
- options.headers['User-Agent'] = `locize-cli/v12.0.1 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
39
+ options.headers['User-Agent'] = `locize-cli/v12.0.2 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
40
40
  options.headers['X-User-Agent'] = options.headers['User-Agent'];
41
41
  if (options.body || options.method !== 'get') options.headers['Content-Type'] = 'application/json';
42
42
  if (options.body) {
package/dist/esm/sync.js CHANGED
@@ -14,7 +14,7 @@ import parseLocalReference from './parseLocalReference.js';
14
14
  import { reversedFileExtensionsMap as reversedFileExtensionsMap$1 } from './formats.js';
15
15
  import deleteNamespace from './deleteNamespace.js';
16
16
  import getProjectStats from './getProjectStats.js';
17
- import locize2xcstrings from 'locize-xcstrings/locize2xcstrings';
17
+ import xcstrings from 'locize-xcstrings';
18
18
  import getBranches from './getBranches.js';
19
19
  import isValidUuid from './isValidUuid.js';
20
20
  import os from 'node:os';
@@ -352,7 +352,7 @@ async function downloadAll (opt, remoteLanguages, omitRef = false, manipulate) {
352
352
  });
353
353
 
354
354
  try {
355
- const converted = locize2xcstrings(locizeData);
355
+ const converted = xcstrings.locize2xcstrings(locizeData);
356
356
 
357
357
  const filledMask = opt.pathMask.replace(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`, '').replace(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`, namespace) + reversedFileExtensionsMap[opt.format];
358
358
  if (opt.dry) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "locize cli to import locales",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",