diff --git a/modules/@angular/compiler-cli/src/codegen.ts b/modules/@angular/compiler-cli/src/codegen.ts index 4a34f86224..10a5340110 100644 --- a/modules/@angular/compiler-cli/src/codegen.ts +++ b/modules/@angular/compiler-cli/src/codegen.ts @@ -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'); }