From e220a800939bea1bf248060245ad4cfe293dd400 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Fri, 26 Aug 2016 15:38:48 -0700 Subject: [PATCH] feat(codegen): Add an error message when the locale is not provided (#11104) --- modules/@angular/compiler-cli/src/codegen.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'); }