Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ο»Ώ@using System.Resources
@using System.Globalization
@using System.Collections

<table>
<thead>
<tr>
<th>Key</th>
<th>Default translation</th>
</tr>
</thead>
<tbody>
@foreach (var entry in _localizedStrings)
{
<tr>
<td>@entry.Key</td>
<td>@entry.Value</td>
</tr>
}
</tbody>
</table>



@code {

private Dictionary<string, string> _localizedStrings = [];

protected override Task OnInitializedAsync()
{
var resourceManager = Microsoft.FluentUI.AspNetCore.Components.Localization.LanguageResource.ResourceManager;
var culture = CultureInfo.InvariantCulture;
ResourceSet? resourceSet = resourceManager.GetResourceSet(culture, true, true);

if (resourceSet is not null)
{
_localizedStrings = resourceSet
.Cast<DictionaryEntry>()
.Where(e => e.Value is string)
.OrderBy(x => x.Key)
.ToDictionary(
e => (string)e.Key,
e => e.Value as string ?? string.Empty
);

}

return base.OnInitializedAsync();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ You can use an embedded resource to store your translations.
}
}
```

## Default translations

{{ LocalizationDefaultTranslations SourceCode=false }}
Loading