From 323464c2f29bc06322bb18e9221dac5c081d807b Mon Sep 17 00:00:00 2001
From: Luke Latham <1622880+guardrex@users.noreply.github.com>
Date: Wed, 8 Sep 2021 05:10:19 -0500
Subject: [PATCH] Additional invariant globalization config (#23224)
---
.../blazor/globalization-localization.md | 117 ++++++++++++++----
aspnetcore/blazor/performance.md | 18 +--
2 files changed, 97 insertions(+), 38 deletions(-)
diff --git a/aspnetcore/blazor/globalization-localization.md b/aspnetcore/blazor/globalization-localization.md
index 632b6978ae..1a4f0823f7 100644
--- a/aspnetcore/blazor/globalization-localization.md
+++ b/aspnetcore/blazor/globalization-localization.md
@@ -63,6 +63,37 @@ The following field types have specific formatting requirements and aren't curre
For current browser support of the preceding types, see [Can I use](https://caniuse.com).
+## Invariant globalization
+
+If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
+
+```xml
+
+ true
+
+```
+
+Alternatively, configure invariant globalization with the following approaches:
+
+* In `runtimeconfig.json`:
+
+ ```json
+ {
+ "runtimeOptions": {
+ "configProperties": {
+ "System.Globalization.Invariant": true
+ }
+ }
+ }
+ ```
+
+* With an environment variable:
+
+ * Key: `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT`
+ * Value: `true` or `1`
+
+For more information, see [Runtime configuration options for globalization (.NET documentation)](/dotnet/core/run-time-config/globalization).
+
## Demonstration component
The following `CultureExample1` component can be used to demonstrate Blazor globalization and localization concepts covered by this article.
@@ -258,14 +289,6 @@ For information on ordering the Localization Middleware in the middleware pipeli
Use the `CultureExample1` component shown in the [Demonstration component](#demonstration-component) section to study how globalization works. Issue a request with United States English (`en-US`). Switch to Chilean Spanish (`es-CL`) in the browser's language settings. Request the webpage again. When the requested language is Chilean Spanish, the app's culture remains United States English (`en-US`).
-If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
-
-```xml
-
- true
-
-```
-
## Dynamically set the culture by user preference
::: zone pivot="webassembly"
@@ -926,6 +949,37 @@ The following field types have specific formatting requirements and aren't curre
For current browser support of the preceding types, see [Can I use](https://caniuse.com).
+## Invariant globalization
+
+If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
+
+```xml
+
+ true
+
+```
+
+Alternatively, configure invariant globalization with the following approaches:
+
+* In `runtimeconfig.json`:
+
+ ```json
+ {
+ "runtimeOptions": {
+ "configProperties": {
+ "System.Globalization.Invariant": true
+ }
+ }
+ }
+ ```
+
+* With an environment variable:
+
+ * Key: `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT`
+ * Value: `true` or `1`
+
+For more information, see [Runtime configuration options for globalization (.NET documentation)](/dotnet/core/run-time-config/globalization).
+
## Demonstration component
The following `CultureExample1` component can be used to demonstrate Blazor globalization and localization concepts covered by this article.
@@ -1121,14 +1175,6 @@ For information on ordering the Localization Middleware in the middleware pipeli
Use the `CultureExample1` component shown in the [Demonstration component](#demonstration-component) section to study how globalization works. Issue a request with United States English (`en-US`). Switch to Chilean Spanish (`es-CL`) in the browser's language settings. Request the webpage again. When the requested language is Chilean Spanish, the app's culture remains United States English (`en-US`).
-If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
-
-```xml
-
- true
-
-```
-
## Dynamically set the culture by user preference
::: zone pivot="webassembly"
@@ -1789,6 +1835,37 @@ The following field types have specific formatting requirements and aren't curre
For current browser support of the preceding types, see [Can I use](https://caniuse.com).
+## Invariant globalization
+
+If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
+
+```xml
+
+ true
+
+```
+
+Alternatively, configure invariant globalization with the following approaches:
+
+* In `runtimeconfig.json`:
+
+ ```json
+ {
+ "runtimeOptions": {
+ "configProperties": {
+ "System.Globalization.Invariant": true
+ }
+ }
+ }
+ ```
+
+* With an environment variable:
+
+ * Key: `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT`
+ * Value: `true` or `1`
+
+For more information, see [Runtime configuration options for globalization (.NET documentation)](/dotnet/core/run-time-config/globalization).
+
## Demonstration component
The following `CultureExample1` component can be used to demonstrate Blazor globalization and localization concepts covered by this article.
@@ -1931,14 +2008,6 @@ For information on ordering the Localization Middleware in the middleware pipeli
Use the `CultureExample1` component shown in the [Demonstration component](#demonstration-component) section to study how globalization works. Issue a request with United States English (`en-US`). Switch to Chilean Spanish (`es-CL`) in the browser's language settings. Request the webpage again. When the requested language is Chilean Spanish, the app's culture remains United States English (`en-US`).
-If the app doesn't require localization, configure the app to support the invariant culture, which is generally based on United States English (`en-US`). Set the `InvariantGlobalization` property to `true` in the app's project file (`.csproj`):
-
-```xml
-
- true
-
-```
-
## Dynamically set the culture by user preference
::: zone pivot="webassembly"
diff --git a/aspnetcore/blazor/performance.md b/aspnetcore/blazor/performance.md
index 60760f2389..6f0d488aef 100644
--- a/aspnetcore/blazor/performance.md
+++ b/aspnetcore/blazor/performance.md
@@ -678,13 +678,7 @@ Blazor WebAssembly's runtime includes the following .NET features that can be di
```
-* By default, Blazor WebAssembly carries globalization resources required to display values, such as dates and currency, in the user's culture. If the app doesn't require localization, you may [configure the app to support the invariant culture](xref:blazor/globalization-localization), which is based on the `en-US` culture:
-
- ```xml
-
- true
-
- ```
+* By default, Blazor WebAssembly carries globalization resources required to display values, such as dates and currency, in the user's culture. If the app doesn't require localization, you may [configure the app to support the invariant culture](xref:blazor/globalization-localization#invariant-globalization), which is based on the `en-US` culture.
::: zone-end
@@ -1350,13 +1344,7 @@ Blazor WebAssembly's runtime includes the following .NET features that can be di
```
-* By default, Blazor WebAssembly carries globalization resources required to display values, such as dates and currency, in the user's culture. If the app doesn't require localization, you may [configure the app to support the invariant culture](xref:blazor/globalization-localization), which is based on the `en-US` culture:
-
- ```xml
-
- true
-
- ```
+* By default, Blazor WebAssembly carries globalization resources required to display values, such as dates and currency, in the user's culture. If the app doesn't require localization, you may [configure the app to support the invariant culture](xref:blazor/globalization-localization#invariant-globalization), which is based on the `en-US` culture.
::: zone-end
@@ -1999,6 +1987,8 @@ Blazor WebAssembly's runtime includes the following .NET features that can be di
```
+* By default, Blazor WebAssembly carries globalization resources required to display values, such as dates and currency, in the user's culture. If the app doesn't require localization, you may [configure the app to support the invariant culture](xref:blazor/globalization-localization#invariant-globalization), which is based on the `en-US` culture.
+
::: zone-end
::: moniker-end