Skip to content

Commit d0b0a1c

Browse files
committed
glossary
1 parent e6808b3 commit d0b0a1c

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ $ npx i18n-auto-translation -k SUBSCRIPTION_KEY -d PROJECT_DIR -t DESIRED_LANGUA
7272
| --trim | -i | Trim string after translation. | true |
7373
| --delay | -e | Delay between every request made to the translate api. | 250 |
7474
| --saveTo | -v | Override where translated file should be saved. (use only with `--filePath` option) | / |
75+
| --glossary | -g | Specify the glossary to use for the translation. Used only by the DeepL API. | / |
7576

7677
## Demo
7778

src/translate/cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface Arguments {
1818
trim: boolean;
1919
delay: number;
2020
saveTo?: string;
21+
glossary?: string;
2122
}
2223

2324
export const argv: Arguments = yargs(process.argv.slice(2))
@@ -128,5 +129,10 @@ export const argv: Arguments = yargs(process.argv.slice(2))
128129
description:
129130
'Override where translated file should be saved. (use only with `--filePath` option)',
130131
},
132+
glossary: {
133+
type: 'string',
134+
alias: 'g',
135+
description: 'Specify the glossary to use for the translation. Used only by the DeepL API.',
136+
},
131137
})
132138
.parseSync();

src/translate/providers/deepl-free-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class DeepLFreeAPI extends Translate {
3131
preserve_formatting: true,
3232
context: argv.context,
3333
formality: argv.formality,
34+
glossary_id: argv.glossary,
3435
},
3536
DeepLFreeAPI.axiosConfig,
3637
);

src/translate/providers/deepl-pro-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class DeepLProAPI extends Translate {
3131
preserve_formatting: true,
3232
context: argv.context,
3333
formality: argv.formality,
34+
glossary_id: argv.glossary,
3435
},
3536
DeepLProAPI.axiosConfig,
3637
);

0 commit comments

Comments
 (0)