@@ -111,7 +111,7 @@ export class AngularCompilerPlugin {
111
111
// Webpack plugin.
112
112
private _firstRun = true ;
113
113
private _donePromise : Promise < void > | null ;
114
- private _normalizedLocale : string ;
114
+ private _normalizedLocale : string | null ;
115
115
private _warnings : ( string | Error ) [ ] = [ ] ;
116
116
private _errors : ( string | Error ) [ ] = [ ] ;
117
117
@@ -1038,7 +1038,7 @@ export class AngularCompilerPlugin {
1038
1038
return { program, emitResult, diagnostics : allDiagnostics } ;
1039
1039
}
1040
1040
1041
- private _validateLocale ( locale : string ) {
1041
+ private _validateLocale ( locale : string ) : string | null {
1042
1042
// Get the path of the common module.
1043
1043
const commonPath = path . dirname ( require . resolve ( '@angular/common/package.json' ) ) ;
1044
1044
// Check if the locale file exists
@@ -1065,11 +1065,12 @@ export class AngularCompilerPlugin {
1065
1065
if ( locales . indexOf ( parentLocale ) !== - 1 ) {
1066
1066
locale = parentLocale ;
1067
1067
} else {
1068
- console . log ( `Unable to load the locale data file "@angular/common/locales/${ locale } ", ` +
1068
+ this . _warnings . push ( `AngularCompilerPlugin: Unable to load the locale data file ` +
1069
+ `"@angular/common/locales/${ locale } ", ` +
1069
1070
`please check that "${ locale } " is a valid locale id.
1070
1071
Proceeding with default locale data registration i.e. 'en'.
1071
1072
If needed, localeData can be registered against custom locale in application module.` ) ;
1072
- locale = 'en' ;
1073
+ return null ;
1073
1074
}
1074
1075
}
1075
1076
}
0 commit comments