Add localized strings and update localization logic
Added new localized strings to `Model.en.resx`, `Model.fr-FR.resx`, and `Model.resx` for additional features/settings in English, French, and German. Updated `SenderEditorPage.razor` to inject `ModelLocalizer` and modified the `L` function to prioritize localized strings from `ModelLocalizer` over `UiLocalizer`. Included `@using EnvelopeGenerator.Domain.Resources` to ensure access to the `Model` resource file. These changes improve localization flexibility and maintainability.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
@using EnvelopeGenerator.Application.Envelopes.Commands
|
||||
@using EnvelopeGenerator.Application.Resources
|
||||
@using EnvelopeGenerator.Domain.Constants
|
||||
@using EnvelopeGenerator.Domain.Resources
|
||||
@using EnvelopeGenerator.Server.Client.Components.PdfEditor
|
||||
@using EnvelopeGenerator.Server.Client.Services
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
@@ -22,6 +23,7 @@
|
||||
@inject EnvelopeTypeService EnvelopeTypeService
|
||||
@inject AuthService AuthService
|
||||
@inject IStringLocalizer<Resource> UiLocalizer
|
||||
@inject IStringLocalizer<Model> ModelLocalizer
|
||||
|
||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||
<link href="_content/DevExpress.Blazor.Viewer/css/dx-blazor-viewer-components.bs5.css" rel="stylesheet" />
|
||||
@@ -1586,7 +1588,11 @@
|
||||
|
||||
string L(string key, string fallback)
|
||||
{
|
||||
var value = UiLocalizer[key];
|
||||
return value.ResourceNotFound ? fallback : value.Value;
|
||||
var modelValue = ModelLocalizer[key];
|
||||
if (!modelValue.ResourceNotFound)
|
||||
return modelValue.Value;
|
||||
|
||||
var uiValue = UiLocalizer[key];
|
||||
return uiValue.ResourceNotFound ? fallback : uiValue.Value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user