Skip to content
Permalink
Browse files

fix(core): ensure that `ngI18nClosureMode` is guarded (#34211)

If the `ngI18nClosureMode` global check actually makes it
through to the runtime, then checks for its existence should
be guarded to prevent `Reference undefined` errors in strict
mode.

(Normally, it is stripped out by dead code elimination during
build optimization.)

PR Close #34211
  • Loading branch information
petebacondarwin authored and mhevery committed Dec 3, 2019
1 parent c92c9f7 commit 25462614db8c3c857086a6bf37190499e586c12e
Showing with 2 additions and 1 deletion.
  1. +2 −1 packages/core/src/application_module.ts
@@ -49,7 +49,8 @@ export function _localeFactory(locale?: string): string {
* * Ivy enabled: use `$localize.locale`
*/
export function getGlobalLocale(): string {
if (ngI18nClosureMode && typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
// * The default `goog.LOCALE` value is `en`, while Angular used `en-US`.
// * In order to preserve backwards compatibility, we use Angular default value over
// Closure Compiler's one.

0 comments on commit 2546261

Please sign in to comment.
You can’t perform that action at this time.