locize-cli 8.7.0 → 8.7.1
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 +4 -0
- package/README.md +2 -1
- package/download.js +11 -7
- package/format.js +3 -1
- package/package.json +1 -1
- package/sync.js +7 -3
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
|
+
## [8.7.1](https://github.com/locize/locize-cli/compare/v8.7.0...v8.7.1) - 2025-04-02
|
|
9
|
+
|
|
10
|
+
- make generated files POSIX compliant, addresses [107](https://github.com/locize/locize-cli/issues/107)
|
|
11
|
+
|
|
8
12
|
## [8.7.0](https://github.com/locize/locize-cli/compare/v8.6.2...v8.7.0) - 2025-03-20
|
|
9
13
|
|
|
10
14
|
- intruduce xcstrings format [106](https://github.com/locize/locize-cli/issues/106)
|
package/README.md
CHANGED
|
@@ -158,9 +158,10 @@ Navigate to your locize project and check the results => [www.locize.app](https:
|
|
|
158
158
|
|
|
159
159
|
## Push missing keys to locize from your repository (or any other local directory)
|
|
160
160
|
This is useful, when i.e. using [i18next-scanner](https://github.com/i18next/i18next-scanner), like described [here](https://github.com/locize/i18next-locize-backend/issues/315#issuecomment-586967039).
|
|
161
|
-
The save-missing command uses the [missing API](https://www.locize.com/docs/api#missing-translations) and the sync command uses the [update API](https://www.locize.com/docs/api#update-remove-translations)
|
|
161
|
+
The save-missing command uses the [missing API](https://www.locize.com/docs/api#missing-translations) and the sync command uses the [update API](https://www.locize.com/docs/api#update-remove-translations).
|
|
162
162
|
So, if you want to save new keys (that does not exist in locize), the save-missing command is the better choice.
|
|
163
163
|
Doing so, you can then for example make use of the “created by missing API" filter in the locize UI.
|
|
164
|
+
Also, using this save-missing command does not generate extra modification costs.
|
|
164
165
|
|
|
165
166
|
But if you need to update existing keys, the sync command is the correct choice.
|
|
166
167
|
|
package/download.js
CHANGED
|
@@ -94,9 +94,10 @@ function handleDownload(opt, url, err, res, downloads, cb) {
|
|
|
94
94
|
if (clb) clb(null);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
97
98
|
if (!opt.version) {
|
|
98
99
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, version, mkdirPath));
|
|
99
|
-
fs.writeFile(path.join(opt.path, version, filledMask),
|
|
100
|
+
fs.writeFile(path.join(opt.path, version, filledMask), fileContent, logAndClb);
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -145,21 +146,22 @@ function handleDownload(opt, url, err, res, downloads, cb) {
|
|
|
145
146
|
if (filledMask.lastIndexOf(path.sep) > 0) {
|
|
146
147
|
mkdirPath = filledMask.substring(0, filledMask.lastIndexOf(path.sep));
|
|
147
148
|
}
|
|
149
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
148
150
|
if (!opt.version) {
|
|
149
151
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, version, mkdirPath));
|
|
150
|
-
fs.writeFile(path.join(opt.path, version, filledMask),
|
|
152
|
+
fs.writeFile(path.join(opt.path, version, filledMask), fileContent, clb);
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
155
|
if (!opt.language) {
|
|
154
156
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, mkdirPath));
|
|
155
|
-
fs.writeFile(path.join(opt.path, filledMask),
|
|
157
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
if (filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + language, '');
|
|
160
162
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
161
163
|
mkdirp.sync(parentDir);
|
|
162
|
-
fs.writeFile(path.join(opt.path, filledMask),
|
|
164
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
163
165
|
});
|
|
164
166
|
});
|
|
165
167
|
}, (err) => {
|
|
@@ -231,7 +233,8 @@ function handlePull(opt, toDownload, cb) {
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, mkdirPath));
|
|
234
|
-
|
|
236
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
237
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, logAndClb);
|
|
235
238
|
} catch (e) {
|
|
236
239
|
err.message = 'Invalid content for "' + opt.format + '" format!\n' + (err.message || '');
|
|
237
240
|
return clb(err);
|
|
@@ -274,16 +277,17 @@ function handlePull(opt, toDownload, cb) {
|
|
|
274
277
|
if (filledMask.lastIndexOf(path.sep) > 0) {
|
|
275
278
|
mkdirPath = filledMask.substring(0, filledMask.lastIndexOf(path.sep));
|
|
276
279
|
}
|
|
280
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
277
281
|
if (!opt.language) {
|
|
278
282
|
if (mkdirPath) mkdirp.sync(path.join(opt.path, mkdirPath));
|
|
279
|
-
fs.writeFile(path.join(opt.path, filledMask),
|
|
283
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
280
284
|
return;
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
if (filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + lng, '');
|
|
284
288
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
285
289
|
mkdirp.sync(parentDir);
|
|
286
|
-
fs.writeFile(path.join(opt.path, filledMask),
|
|
290
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
287
291
|
});
|
|
288
292
|
});
|
|
289
293
|
}, (err) => {
|
package/format.js
CHANGED
|
@@ -113,7 +113,9 @@ function writeLocalFile(opt, file, clb) {
|
|
|
113
113
|
return clb(null, true);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
const fileContent = opt.format !== 'xlsx' ? (file.converted + '\n') : file.converted;
|
|
117
|
+
|
|
118
|
+
fs.writeFile(file.path, fileContent, (err) => clb(err, true));
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
function writeLocalFiles(opt, files, clb) {
|
package/package.json
CHANGED
package/sync.js
CHANGED
|
@@ -268,7 +268,8 @@ const downloadAll = (opt, remoteLanguages, omitRef, manipulate, cb) => {
|
|
|
268
268
|
}
|
|
269
269
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
270
270
|
mkdirp.sync(parentDir);
|
|
271
|
-
|
|
271
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
272
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
272
273
|
} catch (e) {
|
|
273
274
|
err.message = 'Invalid content for "' + opt.format + '" format!\n' + (err.message || '');
|
|
274
275
|
return clb(err);
|
|
@@ -307,7 +308,8 @@ const downloadAll = (opt, remoteLanguages, omitRef, manipulate, cb) => {
|
|
|
307
308
|
}
|
|
308
309
|
const parentDir = path.dirname(path.join(opt.path, filledMask));
|
|
309
310
|
mkdirp.sync(parentDir);
|
|
310
|
-
|
|
311
|
+
const fileContent = opt.format !== 'xlsx' ? (converted + '\n') : converted;
|
|
312
|
+
fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
|
|
311
313
|
});
|
|
312
314
|
});
|
|
313
315
|
}, cb);
|
|
@@ -487,7 +489,9 @@ const backupDeleted = (opt, ns, now) => {
|
|
|
487
489
|
return prev;
|
|
488
490
|
}, {});
|
|
489
491
|
mkdirp.sync(path.join(currentBackupPath, ns.language));
|
|
490
|
-
|
|
492
|
+
const content = JSON.stringify(removingRemote, null, 2);
|
|
493
|
+
const fileContent = opt.format !== 'xlsx' ? (content + '\n') : content;
|
|
494
|
+
fs.writeFileSync(path.join(currentBackupPath, ns.language, `${ns.namespace}.json`), fileContent);
|
|
491
495
|
};
|
|
492
496
|
|
|
493
497
|
const handleSync = (opt, remoteLanguages, localNamespaces, cb) => {
|