添加项目文件。
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
@inject ILocalizationService LocalizationService
|
||||
|
||||
@Text
|
||||
|
||||
@code {
|
||||
private string? _text;
|
||||
|
||||
[Parameter]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public string? Culture { get; set; }
|
||||
|
||||
private string Text => _text ?? Key;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await LoadText();
|
||||
}
|
||||
|
||||
private async Task LoadText()
|
||||
{
|
||||
_text = await LocalizationService.GetStringAsync(Key, Culture) ?? Key;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user