Dosaic.Extensions.Localization.Abstractions
1.2.41
dotnet add package Dosaic.Extensions.Localization.Abstractions --version 1.2.41
NuGet\Install-Package Dosaic.Extensions.Localization.Abstractions -Version 1.2.41
<PackageReference Include="Dosaic.Extensions.Localization.Abstractions" Version="1.2.41" />
<PackageVersion Include="Dosaic.Extensions.Localization.Abstractions" Version="1.2.41" />
<PackageReference Include="Dosaic.Extensions.Localization.Abstractions" />
paket add Dosaic.Extensions.Localization.Abstractions --version 1.2.41
#r "nuget: Dosaic.Extensions.Localization.Abstractions, 1.2.41"
#:package Dosaic.Extensions.Localization.Abstractions@1.2.41
#addin nuget:?package=Dosaic.Extensions.Localization.Abstractions&version=1.2.41
#tool nuget:?package=Dosaic.Extensions.Localization.Abstractions&version=1.2.41
Dosaic.Extensions.Localization.Abstractions
Dosaic.Extensions.Localization.Abstractions is the annotation package for the Dosaic localization system. It provides the [LocalizedName] attribute and the Locale enum that the companion source generator (Dosaic.Extensions.Localization.Generator) reads at compile time to produce a static EntityLabels lookup class.
Installation
dotnet add package Dosaic.Extensions.Localization.Abstractions
Or as a PackageReference in your .csproj:
<PackageReference Include="Dosaic.Extensions.Localization.Abstractions" Version="" />
To also generate the EntityLabels lookup class, add the generator package:
<PackageReference Include="Dosaic.Extensions.Localization.Generator" Version=""
OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
API
[LocalizedName]
Annotate classes, enums, enum members, properties, and fields with translated display names.
using Dosaic.Extensions.Localization;
[LocalizedName(en: "Order", de: "Bestellung")]
public class Order
{
[LocalizedName(en: "Order Number", de: "Bestellnummer")]
public string OrderNumber { get; set; }
}
[LocalizedName(en: "Order Status", de: "Bestellstatus")]
public enum OrderStatus
{
[LocalizedName(en: "Active", de: "Aktiv")]
Active,
[LocalizedName(en: "Cancelled", de: "Storniert")]
Cancelled
}
| Property | Type | Description |
|---|---|---|
En |
string |
English display name (defaults to "") |
De |
string |
German display name (defaults to "") |
Valid targets: Class, Enum, Property, Field (including enum members).
Locale
Strongly-typed culture discriminator used as a parameter in the generated EntityLabels.Get(...) overloads.
public enum Locale
{
En,
De
}
Use Locale.En / Locale.De instead of culture strings when calling the generated API.
Related packages
| Package | Purpose |
|---|---|
Dosaic.Extensions.Localization.Abstractions |
This package — attributes and Locale enum |
Dosaic.Extensions.Localization.Generator |
Roslyn source generator — emits EntityLabels.g.cs and optional JSON translation files at compile time |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.