Text and other languages
Components name their buttons and announce states in English: "Close", "Loading", "Next page", "No matches". Change
most of them on one component, or all of them app-wide with IzzyText.
On one component
Most strings are also a parameter on the components that use them, and that wins over the app's text:
<Dialog Id="confirm" CloseLabel="Schließen">...</Dialog>
<Table Items="Orders" EmptyText="No orders yet">...</Table>App-wide
Register an IzzyText with the strings you want to change; the rest stay English:
builder.Services.AddSingleton(new IzzyText
{
Close = "Schließen",
Loading = "Wird geladen",
});Several languages
Subclass IzzyText and read your resources. The strings are read on every render, so each request gets
its own culture.
public sealed class AppText(IStringLocalizer<AppText> l) : IzzyText
{
public override string Close => l["Close"];
public override string NextPage => l["Next page"];
}
builder.Services.AddLocalization();
builder.Services.AddSingleton<IzzyText, AppText>();
On WebAssembly or Auto pages, register it in the .Client project's Program.cs too:
components in the browser use the English text unless that project has one.
What's in it
About 85 strings, each named for what it says, so IntelliSense lists them. A few, by where they're used:
| Where | Strings |
|---|---|
| Buttons and dialogs | Close, Dismiss, Ok, Confirm, Cancel, Loading, Remove |
| Forms | Optional, Required, FormErrorsTitle, OneError, ErrorCount, ShowPassword, NoMatches, Chosen, Searching, SelectAll, ValueInvalid, NumberInvalid |
| File upload | ChooseFile, DragFilesHere, FileTooLarge, FileWrongType |
| Tables and filters | RowsPerPage, NoItems, SelectRow, Filters, Search, Apply, Clear |
| Navigation | Breadcrumb, Pagination, PreviousPage, NextPage, SkipToContent, MainNavigation, Menu |
| Status | StatusInfo, StatusSuccess, StatusWarning, StatusError, Notifications |
Strings with {0}, such as MoreAvatars ("{0} more"), are format strings.
IzzyText.English is a fresh copy of the built-in text, to start from or compare with.
Next steps
- Forms and validation: labels and messages from your model.
- WebAssembly or Auto: the
.Clientproject's setup.