From 143436a2574ae0836612342438222e9db601c385 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 19 May 2023 05:11:42 -0400 Subject: [PATCH] Custom ICU loading --- .../blazor/globalization-localization.md | 84 ++++++++++++------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/aspnetcore/blazor/globalization-localization.md b/aspnetcore/blazor/globalization-localization.md index 006875006144..7e33611fd721 100644 --- a/aspnetcore/blazor/globalization-localization.md +++ b/aspnetcore/blazor/globalization-localization.md @@ -35,13 +35,6 @@ A limited set of ASP.NET Core's localization features are supported: Not supported: , , and [Data Annotations localization](xref:fundamentals/localization#dataannotations-localization) are ASP.NET Core MVC features and *not supported* in Blazor apps. -:::zone pivot="webassembly" - -> [!IMPORTANT] -> Blazor WebAssembly uses a reduced globalization API and set of built-in locales. Adding locales to a Blazor WebAssembly app isn't supported but is under consideration for .NET 8, which is targeted for release in late 2023. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). - -:::zone-end - This article describes how to use Blazor's globalization and localization features based on: * The [`Accept-Language` header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Accept-Language), which is set by the browser based on a user's language preferences in browser settings. @@ -87,6 +80,32 @@ 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). +:::zone pivot="webassembly" + +## .NET globalization and International Components for Unicode (ICU) support + +:::moniker-end + +:::moniker range=">= aspnetcore-8.0" + +Blazor WebAssembly uses a reduced globalization API and set of built-in International Components for Unicode (ICU) locales. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). + +To load a custom ICU data file to control the app's locales, see [WASM Globalization Icu](https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-icu-wasm.md). Currently, manually building the custom ICU data file is required. .NET tooling to ease the process of creating the file is planned for a future .NET 8.0 preview release. + +:::moniker-end + +:::moniker range=">= aspnetcore-7.0 < aspnetcore-8.0" + +Blazor WebAssembly uses a reduced globalization API and set of built-in International Components for Unicode (ICU) locales. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). + +Loading a custom subset of locales in a Blazor WebAssembly app is supported in .NET 8 or later. For more information, access this section for an 8.0 or later version of this article. + +:::moniker-end + +:::moniker range=">= aspnetcore-7.0" + +:::zone-end + ## 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`): @@ -963,13 +982,6 @@ A limited set of ASP.NET Core's localization features are supported: Not supported: , , and [Data Annotations localization](xref:fundamentals/localization#dataannotations-localization) are ASP.NET Core MVC features and *not supported* in Blazor apps. -:::zone pivot="webassembly" - -> [!IMPORTANT] -> Blazor WebAssembly uses a reduced globalization API and set of built-in locales. Adding locales to a Blazor WebAssembly app isn't supported but is under consideration for .NET 8, which is targeted for release in late 2023. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). - -:::zone-end - This article describes how to use Blazor's globalization and localization features based on: * The [`Accept-Language` header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Accept-Language), which is set by the browser based on a user's language preferences in browser settings. @@ -1015,6 +1027,16 @@ 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). +:::zone pivot="webassembly" + +## .NET globalization and International Components for Unicode (ICU) support + +Blazor WebAssembly uses a reduced globalization API and set of built-in International Components for Unicode (ICU) locales. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). + +Loading a custom subset of locales in a Blazor WebAssembly app is supported in .NET 8 or later. For more information, access this section for an 8.0 or later version of this article. + +:::zone-end + ## 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`): @@ -1899,13 +1921,6 @@ A limited set of ASP.NET Core's localization features are supported: Not supported: , , and [Data Annotations localization](xref:fundamentals/localization#dataannotations-localization) are ASP.NET Core MVC features and *not supported* in Blazor apps. -:::zone pivot="webassembly" - -> [!IMPORTANT] -> Blazor WebAssembly uses a reduced globalization API and set of built-in locales. Adding locales to a Blazor WebAssembly app isn't supported but is under consideration for .NET 8, which is targeted for release in late 2023. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). - -:::zone-end - This article describes how to use Blazor's globalization and localization features based on: * The [`Accept-Language` header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Accept-Language), which is set by the browser based on a user's language preferences in browser settings. @@ -1951,6 +1966,16 @@ 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). +:::zone pivot="webassembly" + +## .NET globalization and International Components for Unicode (ICU) support + +Blazor WebAssembly uses a reduced globalization API and set of built-in International Components for Unicode (ICU) locales. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). + +Loading a custom subset of locales in a Blazor WebAssembly app is supported in .NET 8 or later. For more information, access this section for an 8.0 or later version of this article. + +:::zone-end + ## 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`): @@ -2826,13 +2851,6 @@ A limited set of ASP.NET Core's localization features are supported: Not supported: , , and [Data Annotations localization](xref:fundamentals/localization#dataannotations-localization) are ASP.NET Core MVC features and *not supported* in Blazor apps. -:::zone pivot="webassembly" - -> [!IMPORTANT] -> Blazor WebAssembly uses a reduced globalization API and set of built-in locales. Adding locales to a Blazor WebAssembly app isn't supported but is under consideration for .NET 8, which is targeted for release in late 2023. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). - -:::zone-end - This article describes how to use Blazor's globalization and localization features based on: * The [`Accept-Language` header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Accept-Language), which is set by the browser based on a user's language preferences in browser settings. @@ -2878,6 +2896,16 @@ 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). +:::zone pivot="webassembly" + +## .NET globalization and International Components for Unicode (ICU) support + +Blazor WebAssembly uses a reduced globalization API and set of built-in International Components for Unicode (ICU) locales. For more information, see [.NET globalization and ICU: ICU on WebAssembly](/dotnet/core/extensions/globalization-icu#icu-on-webassembly). + +Loading a custom subset of locales in a Blazor WebAssembly app is supported in .NET 8 or later. For more information, access this section for an 8.0 or later version of this article. + +:::zone-end + ## 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`):