Files
radzen-blazor/Radzen.Blazor/Localizer.cs
Atanas Korchev 43647e292a Add localization service for RadzenSpreadsheet
Introduce a generic localization infrastructure that ships built-in English
defaults via .resx and allows user overrides through a public ILocalizer
interface. The service is designed to work across all Radzen components.

- Add ILocalizer interface for custom translation overrides
- Add internal Localizer class with fallback chain: custom → .resx → key
- Add RadzenStrings.resx with ~120 spreadsheet string keys
- Add UICulture/DefaultUICulture cascading parameter to RadzenComponent
- Add ISpreadsheet.Localize() for sub-component access
- Replace all hardcoded strings in spreadsheet tools, dialogs, and menus
- Register Localizer in AddRadzenComponents() with graceful fallback
- Works with zero configuration; user overrides are optional
2026-06-15 18:45:06 +03:00

15 lines
449 B
C#

using System.Globalization;
using System.Resources;
namespace Radzen;
internal class Localizer(ILocalizer? custom)
{
internal static readonly Localizer Default = new(null);
private readonly ILocalizer? custom = custom;
private readonly ResourceManager resources = Blazor.RadzenStrings.ResourceManager;
public string Get(string key, CultureInfo culture) => custom?.Get(key, culture) ?? resources.GetString(key, culture) ?? key;
}