refactor(localize): update yargs and typings for yargs (#38502)
Updating yargs and typings for the updated yargs module. PR Close #38502
This commit is contained in:

committed by
Andrew Scott

parent
ce448f4341
commit
e8f4294e7f
@ -30,18 +30,21 @@ if (require.main === module) {
|
|||||||
required: true,
|
required: true,
|
||||||
describe:
|
describe:
|
||||||
'The root path of the files to translate, either absolute or relative to the current working directory. E.g. `dist/en`.',
|
'The root path of the files to translate, either absolute or relative to the current working directory. E.g. `dist/en`.',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
.option('s', {
|
.option('s', {
|
||||||
alias: 'source',
|
alias: 'source',
|
||||||
required: true,
|
required: true,
|
||||||
describe:
|
describe:
|
||||||
'A glob pattern indicating what files to translate, relative to the `root` path. E.g. `bundles/**/*`.',
|
'A glob pattern indicating what files to translate, relative to the `root` path. E.g. `bundles/**/*`.',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('l', {
|
.option('l', {
|
||||||
alias: 'source-locale',
|
alias: 'source-locale',
|
||||||
describe:
|
describe:
|
||||||
'The source locale of the application. If this is provided then a copy of the application will be created with no translation but just the `$localize` calls stripped out.',
|
'The source locale of the application. If this is provided then a copy of the application will be created with no translation but just the `$localize` calls stripped out.',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('t', {
|
.option('t', {
|
||||||
@ -54,6 +57,7 @@ if (require.main === module) {
|
|||||||
'If you want to merge multiple translation files for each locale, then provide the list of files in an array.\n' +
|
'If you want to merge multiple translation files for each locale, then provide the list of files in an array.\n' +
|
||||||
'Note that the arrays must be in double quotes if you include any whitespace within the array.\n' +
|
'Note that the arrays must be in double quotes if you include any whitespace within the array.\n' +
|
||||||
'E.g. `-t "[src/locale/messages.en.xlf, src/locale/messages-2.en.xlf]" [src/locale/messages.fr.xlf,src/locale/messages-2.fr.xlf]`',
|
'E.g. `-t "[src/locale/messages.en.xlf, src/locale/messages-2.en.xlf]" [src/locale/messages.fr.xlf,src/locale/messages-2.fr.xlf]`',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('target-locales', {
|
.option('target-locales', {
|
||||||
@ -61,6 +65,7 @@ if (require.main === module) {
|
|||||||
describe:
|
describe:
|
||||||
'A list of target locales for the translation files, which will override any target locale parsed from the translation file.\n' +
|
'A list of target locales for the translation files, which will override any target locale parsed from the translation file.\n' +
|
||||||
'E.g. "-t en fr de".',
|
'E.g. "-t en fr de".',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('o', {
|
.option('o', {
|
||||||
@ -68,7 +73,8 @@ if (require.main === module) {
|
|||||||
required: true,
|
required: true,
|
||||||
describe: 'A output path pattern to where the translated files will be written.\n' +
|
describe: 'A output path pattern to where the translated files will be written.\n' +
|
||||||
'The path must be either absolute or relative to the current working directory.\n' +
|
'The path must be either absolute or relative to the current working directory.\n' +
|
||||||
'The marker `{{LOCALE}}` will be replaced with the target locale. E.g. `dist/{{LOCALE}}`.'
|
'The marker `{{LOCALE}}` will be replaced with the target locale. E.g. `dist/{{LOCALE}}`.',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('m', {
|
.option('m', {
|
||||||
@ -76,6 +82,7 @@ if (require.main === module) {
|
|||||||
describe: 'How to handle missing translations.',
|
describe: 'How to handle missing translations.',
|
||||||
choices: ['error', 'warning', 'ignore'],
|
choices: ['error', 'warning', 'ignore'],
|
||||||
default: 'warning',
|
default: 'warning',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.option('d', {
|
.option('d', {
|
||||||
@ -83,6 +90,7 @@ if (require.main === module) {
|
|||||||
describe: 'How to handle duplicate translations.',
|
describe: 'How to handle duplicate translations.',
|
||||||
choices: ['error', 'warning', 'ignore'],
|
choices: ['error', 'warning', 'ignore'],
|
||||||
default: 'warning',
|
default: 'warning',
|
||||||
|
type: 'string',
|
||||||
})
|
})
|
||||||
|
|
||||||
.strict()
|
.strict()
|
||||||
@ -97,8 +105,8 @@ if (require.main === module) {
|
|||||||
const translationFilePaths: (string|string[])[] = convertArraysFromArgs(options['t']);
|
const translationFilePaths: (string|string[])[] = convertArraysFromArgs(options['t']);
|
||||||
const outputPathFn = getOutputPathFn(fs.resolve(options['o']));
|
const outputPathFn = getOutputPathFn(fs.resolve(options['o']));
|
||||||
const diagnostics = new Diagnostics();
|
const diagnostics = new Diagnostics();
|
||||||
const missingTranslation: DiagnosticHandlingStrategy = options['m'];
|
const missingTranslation = options['m'] as DiagnosticHandlingStrategy;
|
||||||
const duplicateTranslation: DiagnosticHandlingStrategy = options['d'];
|
const duplicateTranslation = options['d'] as DiagnosticHandlingStrategy;
|
||||||
const sourceLocale: string|undefined = options['l'];
|
const sourceLocale: string|undefined = options['l'];
|
||||||
const translationFileLocales: string[] = options['target-locales'] || [];
|
const translationFileLocales: string[] = options['target-locales'] || [];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user