Localization

The Bocons Tag Helper supports multiple languages and are localized. This applies on the one hand to all texts and labels generated within a Tag Helper, but also to date and time outputs.

Support

Currently the following languages are supported:

Language State Available since
English Supported Version 2.1.0
German Supported Version 2.1.0

Usage of Localization

To localize the Tag Helpers, Bocons uses the CultureInfo set in the current thread.

Use the following code snippet to modify the CultureInfo for the current thread:

// Set current thread language to German
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");

The CultureInfo for your ASP.NET Core web application is best set in the Startup.cs within the Configure method:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    ...

    // Language
    var cultureInfo = new CultureInfo("de-DE");
    CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
    CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
}