gtx-cli 2.0.6-alpha.5 → 2.0.6
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 +9 -0
- package/dist/api/sendUpdates.js +1 -1
- package/dist/api/waitForUpdates.js +1 -1
- package/dist/cli/base.js +10 -0
- package/dist/formats/files/translate.js +0 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#444](https://github.com/generaltranslation/gt/pull/444) [`c206a11`](https://github.com/generaltranslation/gt/commit/c206a1158516a0d815b1570d77e6dd62acdcedc4) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add translation interface for generaltranslation
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c206a11`](https://github.com/generaltranslation/gt/commit/c206a1158516a0d815b1570d77e6dd62acdcedc4)]:
|
|
10
|
+
- generaltranslation@7.1.0
|
|
11
|
+
|
|
3
12
|
## 2.0.5
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/api/sendUpdates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { createSpinner, logSuccess, logWarning } from '../console/logging.js';
|
|
2
|
+
import { createSpinner, logSuccess, logWarning, } from '../console/logging.js';
|
|
3
3
|
import updateConfig from '../fs/config/updateConfig.js';
|
|
4
4
|
import { isUsingLocalTranslations } from '../config/utils.js';
|
|
5
5
|
import { gt } from '../utils/gt.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { createOraSpinner, logErrorAndExit } from '../console/logging.js';
|
|
2
|
+
import { createOraSpinner, logErrorAndExit, } from '../console/logging.js';
|
|
3
3
|
import { getLocaleProperties } from 'generaltranslation';
|
|
4
4
|
import { gt } from '../utils/gt.js';
|
|
5
5
|
/**
|
package/dist/cli/base.js
CHANGED
|
@@ -14,6 +14,8 @@ import { installPackage } from '../utils/installPackage.js';
|
|
|
14
14
|
import { getPackageManager } from '../utils/packageManager.js';
|
|
15
15
|
import { retrieveCredentials, setCredentials } from '../utils/credentials.js';
|
|
16
16
|
import { areCredentialsSet } from '../utils/credentials.js';
|
|
17
|
+
import localizeStaticUrls from '../utils/localizeStaticUrls.js';
|
|
18
|
+
import flattenJsonFiles from '../utils/flattenJsonFiles.js';
|
|
17
19
|
export class BaseCLI {
|
|
18
20
|
library;
|
|
19
21
|
additionalModules;
|
|
@@ -175,6 +177,14 @@ See the docs for more information: https://generaltranslation.com/docs/react/tut
|
|
|
175
177
|
const { resolvedPaths: sourceFiles, placeholderPaths, transformPaths, } = settings.files;
|
|
176
178
|
// Process all file types at once with a single call
|
|
177
179
|
await translateFiles(sourceFiles, placeholderPaths, transformPaths, dataFormat, settings);
|
|
180
|
+
// Localize static urls (/docs -> /[locale]/docs)
|
|
181
|
+
if (settings.experimentalLocalizeStaticUrls) {
|
|
182
|
+
await localizeStaticUrls(settings);
|
|
183
|
+
}
|
|
184
|
+
// Flatten json files into a single file
|
|
185
|
+
if (settings.experimentalFlattenJsonFiles) {
|
|
186
|
+
await flattenJsonFiles(settings);
|
|
187
|
+
}
|
|
178
188
|
}
|
|
179
189
|
async handleSetupReactCommand(options) {
|
|
180
190
|
await handleSetupReactCommand(options);
|
|
@@ -11,8 +11,6 @@ import { downloadFile } from '../../api/downloadFile.js';
|
|
|
11
11
|
import { downloadFileBatch } from '../../api/downloadFileBatch.js';
|
|
12
12
|
import { SUPPORTED_FILE_EXTENSIONS } from './supportedFiles.js';
|
|
13
13
|
import sanitizeFileContent from '../../utils/sanitizeFileContent.js';
|
|
14
|
-
import localizeStaticUrls from '../../utils/localizeStaticUrls.js';
|
|
15
|
-
import flattenJsonFiles from '../../utils/flattenJsonFiles.js';
|
|
16
14
|
const SUPPORTED_DATA_FORMATS = ['JSX', 'ICU', 'I18NEXT'];
|
|
17
15
|
/**
|
|
18
16
|
* Sends multiple files to the API for translation
|
|
@@ -104,14 +102,6 @@ export async function translateFiles(filePaths, placeholderPaths, transformPaths
|
|
|
104
102
|
// Check for remaining translations
|
|
105
103
|
await checkFileTranslations(options.projectId, options.apiKey, options.baseUrl, data, locales, 600, (sourcePath, locale) => fileMapping[locale][sourcePath], downloadStatus // Pass the already downloaded files to avoid duplicate requests
|
|
106
104
|
);
|
|
107
|
-
// Localize static urls (/docs -> /[locale]/docs)
|
|
108
|
-
if (options.experimentalLocalizeStaticUrls) {
|
|
109
|
-
await localizeStaticUrls(options);
|
|
110
|
-
}
|
|
111
|
-
// Flatten json files into a single file
|
|
112
|
-
if (options.experimentalFlattenJsonFiles) {
|
|
113
|
-
await flattenJsonFiles(options);
|
|
114
|
-
}
|
|
115
105
|
}
|
|
116
106
|
catch (error) {
|
|
117
107
|
logErrorAndExit(`Error translating files: ${error}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "2.0.6
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"esbuild": "^0.25.4",
|
|
88
88
|
"fast-glob": "^3.3.3",
|
|
89
89
|
"form-data": "^4.0.2",
|
|
90
|
-
"generaltranslation": "^7.1.0
|
|
90
|
+
"generaltranslation": "^7.1.0",
|
|
91
91
|
"open": "^10.1.1",
|
|
92
92
|
"ora": "^8.2.0",
|
|
93
93
|
"resolve": "^1.22.10",
|