@vocab/phrase 1.3.0 → 1.3.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/README.md +3 -3
- package/dist/declarations/src/index.d.ts +2 -2
- package/dist/declarations/src/pull-translations.d.ts +1 -1
- package/dist/declarations/src/push-translations.d.ts +1 -1
- package/dist/vocab-phrase.cjs.d.ts +1 -0
- package/dist/vocab-phrase.cjs.d.ts.map +1 -0
- package/dist/vocab-phrase.cjs.dev.js +2 -2
- package/dist/vocab-phrase.cjs.prod.js +2 -2
- package/dist/vocab-phrase.esm.js +2 -2
- package/package.json +2 -2
- package/dist/declarations/src/csv.d.ts +0 -10
- package/dist/declarations/src/file.d.ts +0 -4
- package/dist/declarations/src/logger.d.ts +0 -3
- package/dist/declarations/src/phrase-api.d.ts +0 -12
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ $ npm i --save @vocab/core @vocab/react
|
|
|
29
29
|
|
|
30
30
|
### Step 2: Configure Vocab
|
|
31
31
|
|
|
32
|
-
You can configure Vocab directly when calling the API or via a `vocab.config.js` file.
|
|
32
|
+
You can configure Vocab directly when calling the API or via a `vocab.config.js` or `vocab.config.cjs` file.
|
|
33
33
|
|
|
34
34
|
In this example we've configured two languages, English and French, where our initial `translation.json` files will use English.
|
|
35
35
|
|
|
@@ -184,7 +184,7 @@ t('my key with component', {
|
|
|
184
184
|
|
|
185
185
|
## Configuration
|
|
186
186
|
|
|
187
|
-
Configuration can either be passed into the Node API directly or be gathered from the nearest _vocab.config.js_ file.
|
|
187
|
+
Configuration can either be passed into the Node API directly or be gathered from the nearest _vocab.config.js_ or _vocab.config.cjs_ file.
|
|
188
188
|
|
|
189
189
|
**vocab.config.js**
|
|
190
190
|
|
|
@@ -341,7 +341,7 @@ functionality.
|
|
|
341
341
|
|
|
342
342
|
### Generating a pseudo-localized language using Vocab
|
|
343
343
|
|
|
344
|
-
Vocab can generate a pseudo-localized language via the [`generatedLanguages` config][generated languages config], either via the webpack plugin or your `vocab.config.js` file.
|
|
344
|
+
Vocab can generate a pseudo-localized language via the [`generatedLanguages` config][generated languages config], either via the webpack plugin or your `vocab.config.js` or `vocab.config.cjs` file.
|
|
345
345
|
`@vocab/pseudo-localize` exports a `generator` that can be used directly in your config.
|
|
346
346
|
|
|
347
347
|
**vocab.config.js**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { pull } from
|
|
2
|
-
export { push } from
|
|
1
|
+
export { pull } from "./pull-translations.js";
|
|
2
|
+
export { push } from "./push-translations.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocab-phrase.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -42,8 +42,8 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
42
42
|
const devLanguageRow = [...sharedData, message];
|
|
43
43
|
csvFilesByLanguage[devLanguage].push(devLanguageRow);
|
|
44
44
|
altLanguages.map(language => {
|
|
45
|
-
var _translations$languag
|
|
46
|
-
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0
|
|
45
|
+
var _translations$languag;
|
|
46
|
+
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message;
|
|
47
47
|
if (altTranslationMessage) {
|
|
48
48
|
csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]);
|
|
49
49
|
}
|
|
@@ -42,8 +42,8 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
42
42
|
const devLanguageRow = [...sharedData, message];
|
|
43
43
|
csvFilesByLanguage[devLanguage].push(devLanguageRow);
|
|
44
44
|
altLanguages.map(language => {
|
|
45
|
-
var _translations$languag
|
|
46
|
-
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0
|
|
45
|
+
var _translations$languag;
|
|
46
|
+
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message;
|
|
47
47
|
if (altTranslationMessage) {
|
|
48
48
|
csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]);
|
|
49
49
|
}
|
package/dist/vocab-phrase.esm.js
CHANGED
|
@@ -30,8 +30,8 @@ function translationsToCsv(translations, devLanguage) {
|
|
|
30
30
|
const devLanguageRow = [...sharedData, message];
|
|
31
31
|
csvFilesByLanguage[devLanguage].push(devLanguageRow);
|
|
32
32
|
altLanguages.map(language => {
|
|
33
|
-
var _translations$languag
|
|
34
|
-
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0
|
|
33
|
+
var _translations$languag;
|
|
34
|
+
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message;
|
|
35
35
|
if (altTranslationMessage) {
|
|
36
36
|
csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]);
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocab/phrase",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/vocab-phrase.cjs.js",
|
|
5
5
|
"module": "dist/vocab-phrase.esm.js",
|
|
6
6
|
"author": "SEEK",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vocab/core": "^1.
|
|
9
|
+
"@vocab/core": "^1.6.0",
|
|
10
10
|
"chalk": "^4.1.0",
|
|
11
11
|
"csv-stringify": "^6.2.3",
|
|
12
12
|
"debug": "^4.3.1",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TranslationsByLanguage } from '@vocab/core';
|
|
2
|
-
export declare function translationsToCsv(translations: TranslationsByLanguage, devLanguage: string): {
|
|
3
|
-
csvFileStrings: {
|
|
4
|
-
[k: string]: string;
|
|
5
|
-
};
|
|
6
|
-
keyIndex: number;
|
|
7
|
-
messageIndex: number;
|
|
8
|
-
commentIndex: number;
|
|
9
|
-
tagColumn: number;
|
|
10
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { TranslationsByLanguage } from '@vocab/core';
|
|
2
|
-
import fetch from 'node-fetch';
|
|
3
|
-
export declare function callPhrase<T = any>(relativePath: string, options?: Parameters<typeof fetch>[1]): Promise<T>;
|
|
4
|
-
export declare function pullAllTranslations(branch: string): Promise<TranslationsByLanguage>;
|
|
5
|
-
export declare function pushTranslations(translationsByLanguage: TranslationsByLanguage, { devLanguage, branch }: {
|
|
6
|
-
devLanguage: string;
|
|
7
|
-
branch: string;
|
|
8
|
-
}): Promise<{
|
|
9
|
-
devLanguageUploadId: string;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function deleteUnusedKeys(uploadId: string, branch: string): Promise<void>;
|
|
12
|
-
export declare function ensureBranch(branch: string): Promise<void>;
|