为 .NET 生态系统提供静态类型化的 i18n 支持
)
The typed internationalizeR
Statically typed i18n support for the .NET - ecosystem
@inject IStringLocalizer localize;
@inject AppUser user;
@localize.Title()
@localize.Welcome_back__userName(user.GivenName)
@inject IStringLocalizer localize;
@inject AppUser user;
@localize["Title"]
@localize["Welcome back, {0}", user.GivenName]
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.
暂无开放 Issues,或尚未同步最近议题。