diff --git a/packages/core/src/application_module.ts b/packages/core/src/application_module.ts index a28a3905a6..aee1f02a3e 100644 --- a/packages/core/src/application_module.ts +++ b/packages/core/src/application_module.ts @@ -30,7 +30,16 @@ export function _keyValueDiffersFactory() { } export function _localeFactory(locale?: string): string { - return locale || 'en-US'; + if (locale) { + return locale; + } + // Use `goog.LOCALE` as default value for `LOCALE_ID` token for Closure Compiler. + // Note: default `goog.LOCALE` value is `en`, when Angular used `en-US`. In order to preserve + // backwards compatibility, we use Angular default value over Closure Compiler's one. + if (ngI18nClosureMode && typeof goog !== 'undefined' && goog.LOCALE !== 'en') { + return goog.LOCALE; + } + return 'en-US'; } /** diff --git a/packages/goog.d.ts b/packages/goog.d.ts index f347fc0f85..25c828eb15 100644 --- a/packages/goog.d.ts +++ b/packages/goog.d.ts @@ -16,6 +16,7 @@ declare namespace goog { * as it is sometimes true. */ export const DEBUG: boolean; + export const LOCALE: string; export const getMsg: (input: string, placeholders?: {[key: string]: string}) => string; }