diff --git a/Oqtane.Client/Modules/Controls/Label.razor b/Oqtane.Client/Modules/Controls/Label.razor index 751b222a4..edccb9ded 100644 --- a/Oqtane.Client/Modules/Controls/Label.razor +++ b/Oqtane.Client/Modules/Controls/Label.razor @@ -1,5 +1,8 @@ @namespace Oqtane.Modules.Controls @inherits ModuleControlBase +@using Microsoft.AspNetCore.Http +@using Microsoft.Extensions.Localization +@inject IHttpContextAccessor HttpContextAccessor @if (!string.IsNullOrEmpty(HelpText)) { @@ -26,6 +29,9 @@ else [Parameter] public string HelpText { get; set; } // optional - tooltip for this label + [Parameter] + public string ResourceKey { get; set; } + protected override void OnParametersSet() { _openLabel = "@localizer[$"{ResourceKey}.Text"]; + HelpText = localizer[$"{ResourceKey}.{nameof(HelpText)}"]; + } + } } } diff --git a/Oqtane.Client/Oqtane.Client.csproj b/Oqtane.Client/Oqtane.Client.csproj index 515bf8f55..eaff964ab 100644 --- a/Oqtane.Client/Oqtane.Client.csproj +++ b/Oqtane.Client/Oqtane.Client.csproj @@ -32,6 +32,7 @@ + diff --git a/Oqtane.Client/Program.cs b/Oqtane.Client/Program.cs index 912720d98..7d3ea0a77 100644 --- a/Oqtane.Client/Program.cs +++ b/Oqtane.Client/Program.cs @@ -26,6 +26,7 @@ public static async Task Main(string[] args) builder.Services.AddSingleton(httpClient); builder.Services.AddOptions(); + builder.Services.AddHttpContextAccessor(); // Register localization services builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");