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");
Please note:
For a complete list of all
CultureInfo
names, visit https://msdn.microsoft.com/en-us/library/hh441729.aspx.
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;
}
Default Language:
If Bocons can not find a suitable language file for the thread culture, the English language file will be used.