Skip to content

Commit 7bcfd81

Browse files
authored
Update note on localization resource loading (#33107)
1 parent 4639b06 commit 7bcfd81

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

aspnetcore/blazor/globalization-localization.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ The following `CultureExample1` component can be used to demonstrate Blazor glob
134134
135135
<h1>Culture Example 1</h1>
136136
137-
<p>
138-
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
139-
</p>
137+
<ul>
138+
<li><b>CurrentCulture</b>: @CultureInfo.CurrentCulture</li>
139+
<li><b>CurrentUICulture</b>: @CultureInfo.CurrentUICulture</li>
140+
</ul>
140141
141142
<h2>Rendered values</h2>
142143
@@ -318,8 +319,8 @@ CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
318319
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");
319320
```
320321

321-
> [!IMPORTANT]
322-
> Always set <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> to the same culture in order to use <xref:Microsoft.Extensions.Localization.IStringLocalizer> and <xref:Microsoft.Extensions.Localization.IStringLocalizer%601>. For more information, see [Blazor WASM doesn't load loc resources unless the current culture and current UI culture are the same (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
322+
> [!NOTE]
323+
> Currently, Blazor WebAssembly apps only load resources based on <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture>. For more information, see [Blazor WASM only relies on the current culture (current UI culture isn't respected) (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
323324
324325
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 Costa Rican Spanish (`es-CR`) in the browser's language settings. Request the webpage again. When the requested language is Costa Rican Spanish, the app's culture remains United States English (`en-US`).
325326

@@ -448,8 +449,8 @@ CultureInfo.DefaultThreadCurrentUICulture = culture;
448449
await host.RunAsync();
449450
```
450451

451-
> [!IMPORTANT]
452-
> Always set <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> to the same culture in order to use <xref:Microsoft.Extensions.Localization.IStringLocalizer> and <xref:Microsoft.Extensions.Localization.IStringLocalizer%601>. For more information, see [Blazor WASM doesn't load loc resources unless the current culture and current UI culture are the same (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
452+
> [!NOTE]
453+
> Currently, Blazor WebAssembly apps only load resources based on <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture>. For more information, see [Blazor WASM only relies on the current culture (current UI culture isn't respected) (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
453454
454455
The following `CultureSelector` component shows how to perform the following actions:
455456

@@ -945,8 +946,8 @@ CultureInfo.DefaultThreadCurrentUICulture = culture;
945946
await host.RunAsync();
946947
```
947948

948-
> [!IMPORTANT]
949-
> Always set <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture> and <xref:System.Globalization.CultureInfo.DefaultThreadCurrentUICulture> to the same culture in order to use <xref:Microsoft.Extensions.Localization.IStringLocalizer> and <xref:Microsoft.Extensions.Localization.IStringLocalizer%601>. For more information, see [Blazor WASM doesn't load loc resources unless the current culture and current UI culture are the same (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
949+
> [!NOTE]
950+
> Currently, Blazor WebAssembly apps only load resources based on <xref:System.Globalization.CultureInfo.DefaultThreadCurrentCulture>. For more information, see [Blazor WASM only relies on the current culture (current UI culture isn't respected) (`dotnet/aspnetcore` #56824)](https://github.com/dotnet/aspnetcore/issues/56824).
950951
951952
Add the following `CultureSelector` component to the `.Client` project.
952953

@@ -1031,9 +1032,10 @@ In the `.Client` project, place the following `CultureClient` component to study
10311032
10321033
<h1>Culture Client</h1>
10331034
1034-
<p>
1035-
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
1036-
</p>
1035+
<ul>
1036+
<li><b>CurrentCulture</b>: @CultureInfo.CurrentCulture</li>
1037+
<li><b>CurrentUICulture</b>: @CultureInfo.CurrentUICulture</li>
1038+
</ul>
10371039
10381040
<h2>Rendered values</h2>
10391041
@@ -1215,9 +1217,10 @@ In the server project, place the following `CultureServer` component to study ho
12151217
12161218
<h1>Culture Server</h1>
12171219
1218-
<p>
1219-
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
1220-
</p>
1220+
<ul>
1221+
<li><b>CurrentCulture</b>: @CultureInfo.CurrentCulture</li>
1222+
<li><b>CurrentUICulture</b>: @CultureInfo.CurrentUICulture</li>
1223+
</ul>
12211224
12221225
<h2>Rendered values</h2>
12231226
@@ -1553,9 +1556,10 @@ Add the namespace for <xref:Microsoft.Extensions.Localization?displayProperty=fu
15531556
15541557
<h1>Culture Example 2</h1>
15551558
1556-
<p>
1557-
<b>CurrentCulture</b>: @CultureInfo.CurrentCulture
1558-
</p>
1559+
<ul>
1560+
<li><b>CurrentCulture</b>: @CultureInfo.CurrentCulture</li>
1561+
<li><b>CurrentUICulture</b>: @CultureInfo.CurrentUICulture</li>
1562+
</ul>
15591563
15601564
<h2>Greeting</h2>
15611565

0 commit comments

Comments
 (0)