feat(codegen): Add an error message when the locale is not provided (#11104)

This commit is contained in:
Victor Berchet 2016-08-26 15:38:48 -07:00 committed by GitHub
parent 3dd85cb7f1
commit e220a80093
1 changed files with 5 additions and 1 deletions

View File

@ -143,7 +143,11 @@ export class CodeGenerator {
const transFile = cliOptions.i18nFile;
const locale = cliOptions.locale;
let transContent: string = '';
if (transFile && locale) {
if (transFile) {
if (!locale) {
throw new Error(
`The translation file (${transFile}) locale must be provided. Use the --locale option.`);
}
transContent = nodeFs.readFileSync(transFile, 'utf8');
}