From a10d6b256eb887c0391283ca37802bd62c79d58c Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:13:42 +0300 Subject: [PATCH 01/10] docs(common): Revamp Localization article --- globalization/localization.md | 316 ++++++++-------------------------- upgrade/overview.md | 2 +- 2 files changed, 73 insertions(+), 245 deletions(-) diff --git a/globalization/localization.md b/globalization/localization.md index 2a3751dfa3..2695e45aee 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -10,301 +10,129 @@ position: 1 # Localization -Localization (L10N) is the process of customizing an app for a given language and region. The Telerik UI for Blazor suite lets you translate its UI elements into the desired language. This includes texts of buttons, filter operators, WAI-ARIA attributes and so on. This article will show you how to use this feature in your application: +Localization (L10N) is the process of customizing an app for a given language and region. Telerik UI for Blazor lets you translate the labels of the UI components to the desired language. This includes the text in buttons, filter operators, WAI-ARIA attributes and so on. This article describes how to use the Telerik localization feature in your Blazor application. +## Basics -1. [How Localization Works in the Telerik Components](#how-localization-works-in-the-telerik-components) -1. [Getting Started with Localization in Your App](#getting-started-with-localization-in-your-app) -1. [Sample Projects](#sample-projects) -1. [Walkthrough - How to Add Globalization and Localization to a Server-side Blazor App](#walkthrough---how-to-add-globalization-and-localization-to-a-server-side-blazor-app) +The localization of the Telerik components builds on top of the standard .NET mechanisms. Familiarity with Blazor localization is required to setup Telerik component localization successfully: -## How Localization Works in the Telerik Components +* [ASP.NET Core Blazor Globalization and Localization](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization) +* [Globalization and Localization in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/localization) -The Telerik UI for Blazor components use a set of keys that a localization service resolves to the strings that will be rendered in the UI. The format of the keys is `_`. Out of the box, the Telerik NuGet package carries a `.resx` file with the default (English) strings. It is used internally if no app-specific service is provided. +The Telerik UI for Blazor components use a [`ITelerikStringLocalizer`](/blazor-ui/api/Telerik.Blazor.Services.ITelerikStringLocalizer) service to resolve localization keys to strings that will render in the UI. The key format is `_`. -You can find the list of keys in the following places: +The `Telerik.UI.for.Blazor` NuGet package includes a [`Telerik.Blazor.Resources.Messages` class](/blazor-ui/api/telerik.blazor.resources.messages) and a resource file with the default English message strings. The components use the built-in `resx` file internally if the app does not define another localization service for the Telerik components. The API reference for the `Messages` class lists all supported localization keys. -* In the [`Telerik.Blazor.Resources.Messages` API reference](/blazor-ui/api/Telerik.Blazor.Resources.Messages.html) -* In the `Resources/TelerikMessages.resx` file in our [Blazor demo site](https://demos.telerik.com/blazor-ui/). Download our [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}). Then, look inside the installation folder, for example `C:\Program Files (x86)\Progress\Telerik UI for Blazor \demos\TelerikBlazorDemos\Resources`. It contains localization (`.resx`) files for a few different languages. -Telerik provides and supports the default English strings. The other language strings are provided as-is, and you can use them as base for implementing your own. +## Localize Telerik Blazor Components -> Update the localization files every time you upgrade Telerik UI for Blazor. Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-null-value-parameter-format%}). +This tutorial assumes that the [Telerik resource files](#step-2-add-resouce-files) reside in `~/Resources/` and have names like `TelerikMessages..resx`. It is possible to use different file and folder names. This will affect the name of the generated static class in `TelerikMessages.Designer.cs`, and the namespaces in the [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service). ->tip You can find translations provided by the community, or contribute your own, in the following repository: UI for Blazor: Translation of TelerikMessages +### Step 1: Set the Blazor App Culture +[Enable Blazor localization and set the application's culture](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization), depending on the business requirements and the hosting model or render mode. -## Getting Started with Localization in Your App +### Step 2: Add Resouce Files -When localizing a Blazor app, make sure you are familiar with how localization works in the framework. The Telerik components localization configuration builds on top of the standard .NET and Blazor localization. You can start from the following resources: +Create and add localization resource `resx` files to your app, based on the languages that the app must support. Use the following links for reference: -* [Globalization and Localization in Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization) -* [Localization in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/localization) +* A full up-to-date list of localization keys is available in the [`Telerik.Blazor.Resources.Messages` API reference](/blazor-ui/api/Telerik.Blazor.Resources.Messages.html). +* An up-to-date English resource file is available in the [Telerik UI for Blazor demo site](https://demos.telerik.com/blazor-ui/). Download the [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}). Go to the installation location and open folder `\demos\TelerikBlazorDemos\Resources\`. The folder contains `resx` localization files for a few different languages. +* Community resource files are available in the `blazor-ui-messages` GitHub repository. These resource files are updated and maintained by the Telerik community. They may not be compatible with the latest product version. You are welcome to contribute your own resource files. +> Update the localization resource files every time you upgrade Telerik UI for Blazor. Otherwise you may see: +> +* Missing or non-translated messages in the UI +* [Exceptions related to missing localization keys]({%slug common-kb-null-value-parameter-format%}) +> +> Telerik supports the default English strings. The `resx` files for the other languages are provided as-is and you can use them as base for implementing your own. -## Sample Projects +Make sure the `resx` files are defined as `EmbeddedResource` in the **Build Action** properties or in the `.csproj` file. Normally, the `Designer` file is generated automatically on every `resx` file save. -You can find sample runnable projects for both server-side Blazor and for WebAssembly in the [Telerik Blazor UI Samples Repo](https://github.com/telerik/blazor-ui/tree/master/common/localization/): - -* Server-side Blazor App Localization Sample Project - -* WebAssembly (Client-side Blazor) App Localization Sample Project - -You can also find an example server-side implementation in our offline demos project that are available your Telerik UI for Blazor installation (both [automated](../installation/automated) and [zip](../installation/zip)). - - -## Walkthrough - How to Add Globalization and Localization to a Server-side Blazor App - -This section will show a tutorial on how to add globalization and localization to a server-side Blazor app. For a WebAssemly app, chek out the [ClientLocalizationResx sample project](https://github.com/telerik/blazor-ui/tree/master/common/localization/ClientLocalizationResx). The majority of the code is to enable localization in the app itself, the Telerik-specific portion is the same in both WebAssembly and server-side Blazor apps - implementing a service to return the translated strings. - ->note When following this tutorial to add localization to an existing app, make sure to compare the configuration you are copying so that you do not remove configuration necessary for your app. Code comments and regions explain details. - -### Step 1: Enable the .NET Core Localization Services - -Here is an example for enabling localization in the app: - ->caption `Program.cs` +>caption Sample resource file configuration in the .csproj file
-````CS -var builder = WebApplication.CreateBuilder(args); - -// ... - -// AddTelerikBlazor() registers the built-in service that includes only the default English labels. -// The actual localizer for the Telerik components must be registered after the line below. -builder.Services.AddTelerikBlazor(); - -#region Localization Part 1 - -// Register your Telerik component localizer after the built-in Telerik services above. -builder.Services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(SampleResxLocalizer)); - -// Standard .NET localization code -builder.Services.AddControllers(); -builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); -builder.Services.Configure(options => -{ - // The list of cultures that the app will support. - var supportedCultures = new List() - { - new CultureInfo("en-US"), - new CultureInfo("de-DE"), - new CultureInfo("es-ES"), - new CultureInfo("bg-BG") - }; - - // Set the default culture. - options.DefaultRequestCulture = new RequestCulture("en-US"); - - options.SupportedCultures = supportedCultures; - options.SupportedUICultures = supportedCultures; -}); - -#endregion Localization Part 1 - -var app = builder.Build(); - -#region Localization Part 2 - -// Standard .NET localization code -app.UseRequestLocalization(app.Services.GetService>().Value); -app.MapControllers(); - -#endregion Localization Part 2 +````XML + + + PublicResXFileCodeGenerator + TelerikMessages.Designer.cs + + + + + True + True + TelerikMessages.resx + + +```` -// ... +### Step 3: Implement ITelerikStringLocalizer Service -app.Run(); -```` +Create a service that implements [`Telerik.Blazor.Services.ITelerikStringLocalizer`](/blazor-ui/api/Telerik.Blazor.Services.ITelerikStringLocalizer). The service must implement an indexer that returns the desired string based on the requested localization key. Normally, the returned string also depends on the current culture, unless you are [using the localization mechanism to override specific UI labels only]({%slug common-kb-localize-selected-localization-keys%}). -### Step 2: Implement the UI Culture Storage (for example, a cookie) +The example below obtains localized strings from resource `resx` files. You can obtain the required strings from any other source, such as a database, `json` files, hash tables, and so on. -Sample controller for changing the thread UI culture and redirecting the user (a redirect is required by the framework): +>caption Localization service that implements ITelerikStringLocalizer
````CS -[Route("[controller]/[action]")] -public class CultureController : Controller +using ServerLocalizationResx.Resources; +using Telerik.Blazor.Services; + +namespace ServerLocalizationResx.Services { - public IActionResult SetCulture(string culture, string redirectUri) + public class SampleResxLocalizer : ITelerikStringLocalizer { - if (culture != null) + // This indexer is required + public string this[string key] { - HttpContext.Response.Cookies.Append( - CookieRequestCultureProvider.DefaultCookieName, - CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture, culture))); + get + { + return TelerikMessages.ResourceManager.GetString(key, TelerikMessages.Culture) ?? key; + } } - - return LocalRedirect(redirectUri); - } - - public IActionResult ResetCulture(string redirectUri) - { - HttpContext.Response.Cookies.Delete(CookieRequestCultureProvider.DefaultCookieName); - - return LocalRedirect(redirectUri); } } ```` -Use a cookie to store the culture choice of the user. Add the cookie in the index file of your app. Depending on the Blazor hosting model and framework version, this index file will differ: +### Step 4: Register Your Telerik Localization Service - * For Client-Side and Blazor Hybrid apps, use the `wwwroot/index.html` file. - * For Server-Side Blazor apps, use one of the following files: - * `~/Pages/_Layout.cshtml` for .NET 6 - * `~/Pages/_Host.cshtml` for .NET 7 - * For Web App projects targeting .NET 8, use the `~/Components/App.razor`. +Register your custom Telerik localization service in `Program.cs` after `builder.Services.AddTelerikBlazor();`. The order is crucial and the Telerik components will always use localization service, which is registered last. If you reorder the two lines below, the components will use the default built-in English localization strings. +>caption Program.cs
-````CSHTML -@using Microsoft.AspNetCore.Localization -@using System.Globalization - - - - - @{ - this.HttpContext.Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, - CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture)) - ); - } - - - - - - -```` - -### Step 3(optional): Add UI for Changing the Culture - -Optionally, create a UI component to allow the user change the culture. - -
- -```` -@using System.Threading - -@inject NavigationManager NavigationManager - -
- Select your language: - - - - - -
- Current UI culture (used for localization): @Thread.CurrentThread.CurrentUICulture.Name -
- Current thread culture (used for date and number formatting): @Thread.CurrentThread.CurrentCulture.Name -
- -@code{ - public class CultureData - { - public string Text { get; set; } - public string Value { get; set; } - } - - private List Cultures { get; set; } = new List() - { - new CultureData() { Text = "English", Value = "en-US" }, - new CultureData() { Text = "French", Value = "fr-FR" }, - new CultureData() { Text = "Bulgarian", Value = "bg-BG" }, - }; - - private string SelectedCulture { get; set; } = Thread.CurrentThread.CurrentUICulture.Name; - - public void OnValueChanged(string eventArgs) - { - SelectedCulture = eventArgs; - - SetCulture(eventArgs); - } - - public void SetCulture(string culture) - { - var uri = new Uri(NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped); - var query = $"?culture={Uri.EscapeDataString(culture)}&redirectUri={Uri.EscapeDataString(uri)}"; - - // use a path that matches your culture redirect controller from the previous steps - NavigationManager.NavigateTo($"{NavigationManager.BaseUri}Culture/SetCulture{query}", forceLoad: true); - } -} -```` - -### Step 4: Add .resx Files to the ~/Resources Folder - -In this example the files must be named `~/Resources/TelerikMessages..resx`, for example `TelerikMessages.bg-BG.resx`. You can use different names (for example, in our demos we use `TelerikMessages.resx`). The file names affect the static class that is generated and how you use it in your code (for example, to localize other elements you define yourself, such as grid command buttons or your own buttons). - -It is required that you add the resource file provided in your Telerik UI for Blazor installation that matches the version used in your project. This is the file that contains the current set of localizable strings and whose designer file must be generated by the build. - -Make sure to: - -* Mark the `resx` files as `Embedded Resource` (right click > Properties > Build Action). -* Have the following in your `ProjectName.csproj` file so the designer file is generated. It should be added when you add the main messages file, or when you open and save it. Copy the snippet in case it is not added. If the `Designer` file does not get generated, open the `resx` file in Visual Studio and toggle its `Access Modifier` to `Public`. +```CS +using Telerik.Blazor.Services; +using ServerLocalizationResx.Services; - **XML** - - - - True - True - TelerikMessages.resx - - - - - - PublicResXFileCodeGenerator - TelerikMessages.Designer.cs - - +// Register the built-in ITelerikStringLocalizer service that returns English strings only +builder.Services.AddTelerikBlazor(); +// Register the custom Telerik localization service +builder.Services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(SampleResxLocalizer)); +``` -### Step 5: Implement a Service for Localizing the Telerik Components -This service must return the desired string based on the current culture and the requested key (see the explanations above). +## Examples -Here is a sample Telerik localization service implementation - this example relies on [a `~/Resources` folder with the necessary `.resx` files]({%slug globalization-localization%}#step-4-add-resx-files-to-the-resources-folder). +You can find sample runnable projects for both server-side Blazor and for WebAssembly in the [Telerik Blazor UI Samples Repo](https://github.com/telerik/blazor-ui/tree/master/common/localization/): ->tip You must implement the indexer only. You can obtain the needed strings from any source you prefer and that matches your application needs, such as database, `resx` files, `json` files, hash tables, and so on. +* Blazor Web App with Server render mode +* Blazor WebAssembly Standalone App -
+You can also find a localization implementation in the offline version of the [Telerik UI for Blazor demos](https://demos.telerik.com/blazor-ui). Check your Telerik UI for Blazor installation folder or visit [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}) for download instructions. -````CS -using Telerik.Blazor.Services; -public class SampleResxLocalizer : ITelerikStringLocalizer -{ - // this is the indexer you must implement - public string this[string name] - { - get - { - return GetStringFromResource(name); - } - } - - // sample implementation - uses .resx files in the ~/Resources folder named TelerikMessages..resx - public string GetStringFromResource(string key) - { - return Resources.TelerikMessages.ResourceManager.GetString(key, Resources.TelerikMessages.Culture); ; - } -} -```` +## Troubleshooting +* This is not related to the Telerik components, but our experience shows that setting `ResourcePath` in `services.AddLocalization()` may break the standard `IStringLocalizer` in your app. ## See Also diff --git a/upgrade/overview.md b/upgrade/overview.md index fa7799a822..bae24fc282 100644 --- a/upgrade/overview.md +++ b/upgrade/overview.md @@ -46,7 +46,7 @@ To upgrade the Telerik UI for Blazor components used in your project, perform th 1. If you are using a local theme stylesheet in `wwwroot`, then replace it. For example, if the app is using a [custom theme]({%slug themes-customize%}), then recreate it with the [ThemeBuilder](https://docs.telerik.com/themebuilder). Or, if the [project was created with the Telerik® UI for Blazor Visual Studio Extensions]({%slug getting-started-vs-integration-new-project%}), then [download the required built-in theme]({%slug themes-overview%}#built-in-themes) and add it to the project. -1. If the application is localized, [update the Telerik localization (`.resx`) files]({%slug globalization-localization%}#how-localization-works-in-the-telerik-components). Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-null-value-parameter-format%}). +1. If the application is localized, [update the Telerik localization resource (`.resx`) files]({%slug globalization-localization%}). Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-null-value-parameter-format%}). ## Upgrade Wizard From a0e08437e9a8b06cf04546655373672176a6dc5f Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:52:48 +0300 Subject: [PATCH 02/10] revamp complete --- globalization/localization.md | 56 ++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/globalization/localization.md b/globalization/localization.md index 2695e45aee..d78cc5a6f4 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -26,7 +26,15 @@ The `Telerik.UI.for.Blazor` NuGet package includes a [`Telerik.Blazor.Resources. ## Localize Telerik Blazor Components -This tutorial assumes that the [Telerik resource files](#step-2-add-resouce-files) reside in `~/Resources/` and have names like `TelerikMessages..resx`. It is possible to use different file and folder names. This will affect the name of the generated static class in `TelerikMessages.Designer.cs`, and the namespaces in the [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service). +The tutorial below assumes that: + +* The Blazor app name and the root namespace is `ServerLocalizationResx`. +* The [Telerik resource files](#step-2-add-resouce-files) exist in folder `~/Resources/` and have names like `TelerikMessages..resx`. + +Using your own names is possible and will affect: + +* The class name and file name of the auto generated designer class (for example, `TelerikMessages` in `TelerikMessages.Designer.cs`) +* The used namespace and class in the [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service) (for example, `AppName.Resources` and `TelerikMessages`) ### Step 1: Set the Blazor App Culture @@ -118,21 +126,61 @@ builder.Services.AddTelerikBlazor(); builder.Services.AddSingleton(typeof(ITelerikStringLocalizer), typeof(SampleResxLocalizer)); ``` +### Step 5: Inject Your Localization Service + +This step is optional. You need it to manually render localized strings from the Telerik resource files. For example, the Telerik resource files include keys for the [built-in Grid commands]({%slug components/grid/columns/command%}). + +* Import the `Telerik.Blazor.Services` namespace. +* Inject your `ITelerikStringLocalizer` service. +* Import the namespace of your Telerik localization `designer.cs` class. + +>caption Localized .razor file with Telerik Blazor components + +
+ +````CSHTML +@using ServerLocalizationResx.Resources + +@using Telerik.Blazor.Services +@inject ITelerikStringLocalizer TelerikLocalizer + +

Localized Strings from Telerik Resource Files

+ +@TelerikLocalizer[nameof(TelerikMessages.Grid_Edit)] +@TelerikLocalizer[nameof(TelerikMessages.Grid_Update)] + +

Localized Strings in Telerik Blazor Components

+ + + + + + + +
+ + + +@code { + private Telerik.DataSource.CompositeFilterDescriptor FilterValue { get; set; } = new(); +} +```` ## Examples You can find sample runnable projects for both server-side Blazor and for WebAssembly in the [Telerik Blazor UI Samples Repo](https://github.com/telerik/blazor-ui/tree/master/common/localization/): -* Blazor Web App with Server render mode -* Blazor WebAssembly Standalone App +* Localized Telerik Blazor Web App with Server render mode +* Localized Telerik Blazor WebAssembly Standalone App You can also find a localization implementation in the offline version of the [Telerik UI for Blazor demos](https://demos.telerik.com/blazor-ui). Check your Telerik UI for Blazor installation folder or visit [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}) for download instructions. ## Troubleshooting +Outdated Telerik resource files may cause [some UI labels to appear in English]({%slug common-kb-partial-localization%}), or the app may trigger a [`Value cannot be null. (Parameter 'format')` exception]({%slug common-kb-value-cannot-be-null-parameter-format%}). -* This is not related to the Telerik components, but our experience shows that setting `ResourcePath` in `services.AddLocalization()` may break the standard `IStringLocalizer` in your app. +This is not related to the Telerik components, but setting `ResourcePath` in `services.AddLocalization()` may break the standard `IStringLocalizer` in your app or make it more difficult to use. ## See Also From 4b57663d6d79a39b6f56adaf28d1941e37e1662a Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:41:04 +0300 Subject: [PATCH 03/10] Update upgrade/overview.md --- upgrade/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade/overview.md b/upgrade/overview.md index bae24fc282..35fb59f269 100644 --- a/upgrade/overview.md +++ b/upgrade/overview.md @@ -46,7 +46,7 @@ To upgrade the Telerik UI for Blazor components used in your project, perform th 1. If you are using a local theme stylesheet in `wwwroot`, then replace it. For example, if the app is using a [custom theme]({%slug themes-customize%}), then recreate it with the [ThemeBuilder](https://docs.telerik.com/themebuilder). Or, if the [project was created with the Telerik® UI for Blazor Visual Studio Extensions]({%slug getting-started-vs-integration-new-project%}), then [download the required built-in theme]({%slug themes-overview%}#built-in-themes) and add it to the project. -1. If the application is localized, [update the Telerik localization resource (`.resx`) files]({%slug globalization-localization%}). Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-null-value-parameter-format%}). +1. If the application is localized, [update the Telerik localization resource (`.resx`) files]({%slug globalization-localization%}#step-2-add-resouce-files). Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-value-cannot-be-null-parameter-format%}). ## Upgrade Wizard From 2c25ca5579c94bd8a42a6e30147474d6f3bd2553 Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:01:00 +0300 Subject: [PATCH 04/10] Add a small note --- globalization/localization.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/globalization/localization.md b/globalization/localization.md index d78cc5a6f4..fd7ac13462 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -40,6 +40,10 @@ Using your own names is possible and will affect: [Enable Blazor localization and set the application's culture](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization), depending on the business requirements and the hosting model or render mode. +The purpose of this step is to supply the correct application culture to the `ResourceManager.GetString()` method in your [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service). This is turn will obtain the localized string from the correct resource file with a matching locale in its file name. + +>tip This step is optional if your Blazor application will always use the same culture and a single Telerik resource file without a locale in its name. + ### Step 2: Add Resouce Files Create and add localization resource `resx` files to your app, based on the languages that the app must support. Use the following links for reference: From 6d4786aec1883317e2b5c81efb889e18f82175dc Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:24:57 +0300 Subject: [PATCH 05/10] Update globalization/localization.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- globalization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalization/localization.md b/globalization/localization.md index fd7ac13462..43b9ae0ac8 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -14,7 +14,7 @@ Localization (L10N) is the process of customizing an app for a given language an ## Basics -The localization of the Telerik components builds on top of the standard .NET mechanisms. Familiarity with Blazor localization is required to setup Telerik component localization successfully: +The localization of the Telerik components builds on top of the standard .NET mechanisms. Familiarity with Blazor localization is required to set up Telerik component localization successfully: * [ASP.NET Core Blazor Globalization and Localization](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization) * [Globalization and Localization in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/localization) From 3013e427ca2f8c4cec72d9668a94bbc6c0b9a89e Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:25:15 +0300 Subject: [PATCH 06/10] Update globalization/localization.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- globalization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalization/localization.md b/globalization/localization.md index 43b9ae0ac8..290d94147c 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -40,7 +40,7 @@ Using your own names is possible and will affect: [Enable Blazor localization and set the application's culture](https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization), depending on the business requirements and the hosting model or render mode. -The purpose of this step is to supply the correct application culture to the `ResourceManager.GetString()` method in your [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service). This is turn will obtain the localized string from the correct resource file with a matching locale in its file name. +The purpose of this step is to supply the correct application culture to the `ResourceManager.GetString()` method in your [Telerik localization service](#step-3-implement-itelerikstringlocalizer-service). This in turn will obtain the localized string from the correct resource file with a matching locale in its file name. >tip This step is optional if your Blazor application will always use the same culture and a single Telerik resource file without a locale in its name. From 54ae74781ddb7472073cdc3d653d8e299b2ccd7e Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:25:25 +0300 Subject: [PATCH 07/10] Update globalization/localization.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- globalization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalization/localization.md b/globalization/localization.md index 290d94147c..99da041081 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -49,7 +49,7 @@ The purpose of this step is to supply the correct application culture to the `Re Create and add localization resource `resx` files to your app, based on the languages that the app must support. Use the following links for reference: * A full up-to-date list of localization keys is available in the [`Telerik.Blazor.Resources.Messages` API reference](/blazor-ui/api/Telerik.Blazor.Resources.Messages.html). -* An up-to-date English resource file is available in the [Telerik UI for Blazor demo site](https://demos.telerik.com/blazor-ui/). Download the [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}). Go to the installation location and open folder `\demos\TelerikBlazorDemos\Resources\`. The folder contains `resx` localization files for a few different languages. +* An up-to-date English resource file is available in the [Telerik UI for Blazor demo site](https://demos.telerik.com/blazor-ui/). Download the [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}). Go to the installation location and open the folder `\demos\TelerikBlazorDemos\Resources\`. The folder contains `resx` localization files for a few different languages. * Community resource files are available in the `blazor-ui-messages` GitHub repository. These resource files are updated and maintained by the Telerik community. They may not be compatible with the latest product version. You are welcome to contribute your own resource files. > Update the localization resource files every time you upgrade Telerik UI for Blazor. Otherwise you may see: From 58b55a3f3b852b0f772cc137220956ddb489e81d Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:26:07 +0300 Subject: [PATCH 08/10] Update globalization/localization.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- globalization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalization/localization.md b/globalization/localization.md index 99da041081..8e49e0fde7 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -113,7 +113,7 @@ namespace ServerLocalizationResx.Services ### Step 4: Register Your Telerik Localization Service -Register your custom Telerik localization service in `Program.cs` after `builder.Services.AddTelerikBlazor();`. The order is crucial and the Telerik components will always use localization service, which is registered last. If you reorder the two lines below, the components will use the default built-in English localization strings. +Register your custom Telerik localization service in `Program.cs` after `builder.Services.AddTelerikBlazor();`. The order is crucial and the Telerik components will always use the last registered localization service. If you reorder the two lines below, the components will use the default built-in English localization strings. >caption Program.cs From 261c0e1c627678eeeca7058bce0d1b85023f6275 Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:26:20 +0300 Subject: [PATCH 09/10] Update globalization/localization.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- globalization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globalization/localization.md b/globalization/localization.md index 8e49e0fde7..c05fcaf1d0 100644 --- a/globalization/localization.md +++ b/globalization/localization.md @@ -174,7 +174,7 @@ This step is optional. You need it to manually render localized strings from the You can find sample runnable projects for both server-side Blazor and for WebAssembly in the [Telerik Blazor UI Samples Repo](https://github.com/telerik/blazor-ui/tree/master/common/localization/): -* Localized Telerik Blazor Web App with Server render mode +* Localized Telerik Blazor Web App with Server Render Mode * Localized Telerik Blazor WebAssembly Standalone App You can also find a localization implementation in the offline version of the [Telerik UI for Blazor demos](https://demos.telerik.com/blazor-ui). Check your Telerik UI for Blazor installation folder or visit [UI for Blazor automated installer]({%slug installation/msi%}) or [UI for Blazor ZIP archive]({%slug installation/zip%}) for download instructions. From bb8d8168a6eb2460feac8e46e66ed1ef0fe1af98 Mon Sep 17 00:00:00 2001 From: Dimo Dimov <961014+dimodi@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:26:58 +0300 Subject: [PATCH 10/10] Update upgrade/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- upgrade/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrade/overview.md b/upgrade/overview.md index 35fb59f269..d49a2e2be5 100644 --- a/upgrade/overview.md +++ b/upgrade/overview.md @@ -46,7 +46,7 @@ To upgrade the Telerik UI for Blazor components used in your project, perform th 1. If you are using a local theme stylesheet in `wwwroot`, then replace it. For example, if the app is using a [custom theme]({%slug themes-customize%}), then recreate it with the [ThemeBuilder](https://docs.telerik.com/themebuilder). Or, if the [project was created with the Telerik® UI for Blazor Visual Studio Extensions]({%slug getting-started-vs-integration-new-project%}), then [download the required built-in theme]({%slug themes-overview%}#built-in-themes) and add it to the project. -1. If the application is localized, [update the Telerik localization resource (`.resx`) files]({%slug globalization-localization%}#step-2-add-resouce-files). Otherwise you may see [exceptions related to missing localization strings]({%slug common-kb-value-cannot-be-null-parameter-format%}). +1. If the application is localized, [update the Telerik localization resource (`.resx`) files]({%slug globalization-localization%}#step-2-add-resouce-files). Otherwise, you may see [exceptions related to missing localization strings]({%slug common-kb-value-cannot-be-null-parameter-format%}). ## Upgrade Wizard