Skip to content

Commit

Permalink
refactor: simplify the LOCALE_ID provider (#43913)
Browse files Browse the repository at this point in the history
Other parts of the intialization process are responsible for passing the locale id to ivy, so it does not need to happen in the provider factory. E.g. `PlatformRef.bootstrapModule()` and `R3TestBedCompiler.finalize()`.

PR Close #43913
  • Loading branch information
petebacondarwin authored and alxhub committed Oct 28, 2021
1 parent 70d3805 commit c315878
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
8 changes: 1 addition & 7 deletions packages/core/src/application_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {ComponentFactoryResolver} from './linker';
import {Compiler} from './linker/compiler';
import {NgModule} from './metadata';
import {SCHEDULER} from './render3/component_ref';
import {setLocaleId} from './render3/i18n/i18n_locale_id';
import {NgZone} from './zone';

declare const $localize: {locale?: string};
Expand All @@ -34,13 +33,8 @@ export function _keyValueDiffersFactory() {
}

export function _localeFactory(locale?: string): string {
locale = locale || getGlobalLocale();
if (ivyEnabled) {
setLocaleId(locale);
}
return locale;
return locale || getGlobalLocale();
}

/**
* Work out the locale from the potential global properties.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1532,9 +1532,6 @@
{
"name": "setIsInCheckNoChangesMode"
},
{
"name": "setLocaleId"
},
{
"name": "setSelectedIndex"
},
Expand Down Expand Up @@ -1682,4 +1679,4 @@
{
"name": "ɵɵtext"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1505,9 +1505,6 @@
{
"name": "setIsInCheckNoChangesMode"
},
{
"name": "setLocaleId"
},
{
"name": "setSelectedIndex"
},
Expand Down Expand Up @@ -1664,4 +1661,4 @@
{
"name": "ɵɵtext"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1928,9 +1928,6 @@
{
"name": "setIsInCheckNoChangesMode"
},
{
"name": "setLocaleId"
},
{
"name": "setRouterState"
},
Expand Down Expand Up @@ -2138,4 +2135,4 @@
{
"name": "ɵɵtextInterpolate1"
}
]
]

0 comments on commit c315878

Please sign in to comment.