Skip to content

Latest commit

 

History

History
85 lines (61 loc) · 4.85 KB

README.md

File metadata and controls

85 lines (61 loc) · 4.85 KB

build Coverage Status CodeQL Publish

Quality Gate Status Lines of Code Duplicated Lines (%) Code Smells Maintainability Rating Security Rating Bugs Vulnerabilities Reliability Rating Technical Debt

Samples STS Samples LTS

NuGet Nuget NuGet (preview)

TypealizR

The typed internationalizeR

Statically typed i18n support for the .NET - ecosystem

✔️ DO this:

@inject IStringLocalizer<HomePage> localize;
@inject AppUser user;

<h1>@localize.Title()<h1>
<h2>@localize.Welcome_back__userName(user.GivenName)<h2>

demo_typealize_translation_initial

DON´T do that:

@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

✔️ DO this:

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!".
}

DON´T do that:

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.