26 lines
514 B
Plaintext
26 lines
514 B
Plaintext
@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();
|
|
}
|
|
} |