Skip to content

Commit bc7cde0

Browse files
petebacondarwinmhevery
authored andcommitted
fix(core): ensure that ngI18nClosureMode is guarded (angular#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 angular#34211
1 parent cca2616 commit bc7cde0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/application_module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export function _localeFactory(locale?: string): string {
4949
* * Ivy enabled: use `$localize.locale`
5050
*/
5151
export function getGlobalLocale(): string {
52-
if (ngI18nClosureMode && typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
52+
if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
53+
typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
5354
// * The default `goog.LOCALE` value is `en`, while Angular used `en-US`.
5455
// * In order to preserve backwards compatibility, we use Angular default value over
5556
// Closure Compiler's one.

0 commit comments

Comments
 (0)