You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/globalization-localization.md
+45-7Lines changed: 45 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,7 +254,17 @@ Add the following line to the `Program` file where services are registered:
254
254
builder.Services.AddLocalization();
255
255
```
256
256
257
-
In ***server-side development***, you can specify the app's supported cultures immediately after Routing Middleware is added to the processing pipeline. The following example configures supported cultures for United States English and Costa Rican Spanish:
257
+
:::moniker range=">= aspnetcore-8.0"
258
+
259
+
In ***server-side development***, specify the app's supported cultures before any middleware that might check the request culture. Generally, place Request Localization Middleware immediately before calling <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>. The following example configures supported cultures for United States English and Costa Rican Spanish:
260
+
261
+
:::moniker-end
262
+
263
+
:::moniker range="< aspnetcore-8.0"
264
+
265
+
In ***server-side development***, specify the app's supported cultures immediately after Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>) is added to the processing pipeline. The following example configures supported cultures for United States English and Costa Rican Spanish:
Specify the static culture in the `Program` file immediately after Routing Middleware is added to the processing pipeline. The following example configures United States English:
384
+
:::moniker-end
385
+
386
+
:::moniker range=">= aspnetcore-8.0"
387
+
388
+
Specify the static culture in the `Program` file before any middleware that might check the request culture. Generally, place Request Localization Middleware immediately before <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>. The following example configures United States English:
Specify the static culture in the `Program` file immediately after Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>) is added to the processing pipeline. The following example configures United States English:
395
+
396
+
:::moniker-end
397
+
398
+
:::moniker range=">= aspnetcore-6.0"
375
399
376
400
```csharp
377
401
app.UseRequestLocalization("en-US");
@@ -638,13 +662,13 @@ Set the app's default and supported cultures with <xref:Microsoft.AspNetCore.Bui
638
662
639
663
:::moniker range=">= aspnetcore-8.0"
640
664
641
-
Before the call to `app.MapRazorComponents` in the request processing pipeline, place the following code:
665
+
Before the call to <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A> in the request processing pipeline, place the following code:
642
666
643
667
:::moniker-end
644
668
645
669
:::moniker range="< aspnetcore-8.0"
646
670
647
-
After the call to `app.UseRouting` in the request processing pipeline, place the following code:
671
+
After Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>) is added to the request processing pipeline, place the following code:
Set the app's default and supported cultures with <xref:Microsoft.AspNetCore.Builder.RequestLocalizationOptions>.
1127
1151
1128
-
Before the call to `app.MapRazorComponents` in the request processing pipeline, place the following code:
1152
+
Before the call to <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A> in the request processing pipeline, place the following code:
1129
1153
1130
1154
```csharp
1131
1155
varsupportedCultures=new[] { "en-US", "es-CR" };
@@ -1366,7 +1390,21 @@ If the app doesn't already support dynamic culture selection:
1366
1390
builder.Services.AddLocalization();
1367
1391
```
1368
1392
1369
-
Immediately after Routing Middleware is added to the processing pipeline:
1393
+
:::moniker-end
1394
+
1395
+
:::moniker range=">= aspnetcore-8.0"
1396
+
1397
+
Place Request Localization Middleware before any middleware that might check the request culture. Generally, place the middleware immediately before calling <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>:
Immediately after Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>) is added to the processing pipeline:
1404
+
1405
+
:::moniker-end
1406
+
1407
+
:::moniker range=">= aspnetcore-6.0"
1370
1408
1371
1409
```csharp
1372
1410
varsupportedCultures=new[] { "en-US", "es-CR" };
@@ -1393,7 +1431,7 @@ In `Startup.ConfigureServices` (`Startup.cs`):
1393
1431
services.AddLocalization();
1394
1432
```
1395
1433
1396
-
In `Startup.Configure` immediately after Routing Middleware is added to the processing pipeline:
1434
+
In `Startup.Configure` immediately after Routing Middleware (<xref:Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseRouting%2A>) is added to the processing pipeline:
> If you're using .NET 9 SDK or later, see the updated Linux procedures in the [.NET 9 version of this article](?view=aspnetcore-9.0&preserve-view=true).
@@ -263,6 +263,7 @@ See [this GitHub issue](https://github.com/dotnet/AspNetCore.Docs/issues/6199).
263
263
264
264
Establishing trust is distribution and browser specific. The following sections provide instructions for some popular distributions and the Chromium browsers (Edge and Chrome) and for Firefox.
265
265
266
+
<!-- Uncomment when linus-dev-certs supports .NET 6.0>
266
267
### Trust HTTPS certificate on Linux with linux-dev-certs
267
268
268
269
[linux-dev-certs](https://github.com/tmds/linux-dev-certs) is an open-source, community-supported, .NET global tool that provides a convenient way to create and trust a developer certificate on Linux. The tool is not maintained or supported by Microsoft.
0 commit comments