feat(ivy): allow the locale to be set via a global property (#33314)
In the post-$localize world the current locale value is defined by setting `$localize.locale` which is then read at runtime by Angular in the provider for the `LOCALE_ID` token and also passed to the ivy machinery via`setLocaleId()`. The $localize compile-time inlining tooling can replace occurrences of `$localize.locale` with a string literal, similar to how translations are inlined. // FW-1639 See https://github.com/angular/angular-cli/issues/15896 PR Close #33314
This commit is contained in:

committed by
Andrew Kushnir

parent
ed4244e932
commit
fde8363e0d
@ -20,6 +20,22 @@ export interface LocalizeFn {
|
||||
* different translations.
|
||||
*/
|
||||
translate?: TranslateFn;
|
||||
/**
|
||||
* The current locale of the translated messages.
|
||||
*
|
||||
* The compile-time translation inliner is able to replace the following code:
|
||||
*
|
||||
* ```
|
||||
* $localize && $localize.locale
|
||||
* ```
|
||||
*
|
||||
* with a string literal of the current locale. E.g.
|
||||
*
|
||||
* ```
|
||||
* "fr"
|
||||
* ```
|
||||
*/
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface TranslateFn {
|
||||
|
Reference in New Issue
Block a user