Skip to content
IzzyBlazor 0.1.0-alpha.17

Enter all results ↑ ↓ move Esc close

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:

razor
<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:

Program.cs
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.

csharp
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:

WhereStrings
Buttons and dialogsClose, Dismiss, Ok, Confirm, Cancel, Loading, Remove
FormsOptional, Required, FormErrorsTitle, OneError, ErrorCount, ShowPassword, NoMatches, Chosen, Searching, SelectAll, ValueInvalid, NumberInvalid
File uploadChooseFile, DragFilesHere, FileTooLarge, FileWrongType
Tables and filtersRowsPerPage, NoItems, SelectRow, Filters, Search, Apply, Clear
NavigationBreadcrumb, Pagination, PreviousPage, NextPage, SkipToContent, MainNavigation, Menu
StatusStatusInfo, 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.

Info:
Validation messages come from your model's attributes: set ErrorMessage, or localize them as you would for any Blazor form. Three come from IzzyBlazor, for a value that can't be read: IzzyText.NumberInvalid (letters in a number field), ColorInvalid, and ValueInvalid for any other type.

Next steps