https://github.com/earloc/TypealizR
Statically typed i18n support for the .NET - ecosystem
https://github.com/earloc/TypealizR
csharp dotnet i18n resx roslyn-generator
Last synced: 5 months ago
JSON representation
Statically typed i18n support for the .NET - ecosystem
- Host: GitHub
- URL: https://github.com/earloc/TypealizR
- Owner: earloc
- License: mit
- Created: 2022-11-06T22:20:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-04T19:07:36.000Z (5 months ago)
- Last Synced: 2024-11-04T20:20:19.628Z (5 months ago)
- Topics: csharp, dotnet, i18n, resx, roslyn-generator
- Language: C#
- Homepage:
- Size: 2.04 MB
- Stars: 75
- Watchers: 3
- Forks: 3
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - TypealizR
README
[](https://github.com/earloc/TypealizR/actions/workflows/build.yml)
[](https://coveralls.io/github/earloc/TypealizR?branch=main)
[](https://github.com/earloc/TypealizR/actions/workflows/codeql.yml)
[](https://github.com/earloc/TypealizR/actions/workflows/publish.yml)[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)
[](https://sonarcloud.io/summary/new_code?id=earloc_TypealizR)[](https://github.com/earloc/TypealizR/actions/workflows/samples_sts.yml)
[](https://github.com/earloc/TypealizR/actions/workflows/samples_lts.yml)[](https://www.nuget.org/packages/TypealizR)

[]((https://www.nuget.org/packages/TypealizR))# TypealizR
> The **type**d internation**aliz**e**R**Statically typed i18n support for the .NET - ecosystem
## [resource-first](https://github.com/earloc/TypealizR/blob/main/docs/resource-first.md)
### ✔️ **DO** this:
```csharp
@inject IStringLocalizer localize;
@inject AppUser user;@localize.Title()
@localize.Welcome_back__userName(user.GivenName)
```

### ❌ **DON´T** do that:
```csharp
@inject IStringLocalizer localize;
@inject AppUser user;@localize["Title"]
@localize["Welcome back, {0}", user.GivenName]
```
See [resource-first](https://github.com/earloc/TypealizR/blob/main/docs/resource-first.md) for more details
## [code-first](https://github.com/earloc/TypealizR/blob/main/docs/code-first.md)
### ✔️ **DO** this:
```csharp
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:
```csharp
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](https://github.com/earloc/TypealizR/blob/main/docs/code-first.md) for more details.