Additional invariant globalization config (#23224)
parent
b490582c63
commit
323464c2f2
|
@ -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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
## 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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
## 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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
## Dynamically set the culture by user preference
|
||||
|
||||
::: zone pivot="webassembly"
|
||||
|
|
|
@ -678,13 +678,7 @@ Blazor WebAssembly's runtime includes the following .NET features that can be di
|
|||
</PropertyGroup>
|
||||
```
|
||||
|
||||
* 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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
* 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
|
|||
</PropertyGroup>
|
||||
```
|
||||
|
||||
* 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
|
||||
<PropertyGroup>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
```
|
||||
* 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
|
|||
</PropertyGroup>
|
||||
```
|
||||
|
||||
* 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
|
||||
|
|
Loading…
Reference in New Issue