The typed internationalizeR
Statically typed i18n support for the .NET - ecosystem
@inject IStringLocalizer<HomePage> localize;
@inject AppUser user;
<h1>@localize.Title()<h1>
<h2>@localize.Welcome_back__userName(user.GivenName)<h2>
@inject IStringLocalizer<HomePage> localize;
@inject AppUser user;
<h1>@localize["Title"]<h1>
<h2>@localize["Welcome back, {0}", user.GivenName]<h2>
See resource-first for more details
void Demo(ILocalizables i18n)
{
Console.WriteLine(i18n.Hello("Earth")); // Hello Earth
Console.WriteLine(i18n.Farewell("Arthur")); // So long, 'Arthur'. And thx for all the fish!
Console.WriteLine(i18n.WhatIsTheMeaningOfLifeTheUniverseAndEverything); // 42
Console.WriteLine(i18n.Greet(right: "Zaphod", left: "Arthur")); // Arthur greets Zaphod, and Zaphod replies: "Hi!".
}
void Demo(IStringLocalizer i18n)
{
Console.WriteLine(i18n["Hello", "Earth"]); // Hello Earth
Console.WriteLine(i18n["Farewell", "Arthur"]); // So long, 'Arthur'. And thx for all the fish!
Console.WriteLine(i18n["WhatIsTheMeaningOfLifeTheUniverseAndEverything"]; // 42
Console.WriteLine(i18n["Greet", "Arthur", "Zaphod")); // Arthur greets Zaphod, and Zaphod replies: "Hi!".
}
See code-first for more details.