Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 753 Bytes

README.md

File metadata and controls

24 lines (17 loc) · 753 Bytes

.NET string localizer with culture

Implements IStringLocalizer that is bound to specific culture.

See dotnet/aspnetcore#7756 for context.

Installation

PM> Install-Package Rapal.StringLocalizerWithCulture

Usage

var services = new ServiceCollection()
    .AddLocalizationWithCulture(options => options.ResourcesPath = "Resources")
    .BuildServiceProvider();

var localizerFactory = services.GetRequiredService<IStringLocalizerWithCultureFactory>();
var localizer = localizerFactory.Create(typeof(MyClass), CultureInfo.GetCultureInfo("en-US"));
var translated = localizer["Hello"];