Localization in ASP.NET Core 1.0 and MVC 6

Previous ASP.NET localization approach was quite old. It was just based on resources and there was nothing wrong with this but lot of projects uses other sources of localized texts (for example database). In ASP.NET Core 1.0 it’s completely rewritten! Configuring Localization middleware The localization is configured in Startup class, where we need to enable Localization middle…

By Dawid on (tags: asp.net core 1.0, localization, mvc6, categories: code)

Keep your culture consistent among threads.

Have you ever had a problem that your multithreaded application lost a culture context ? Have you found a good solution for this? I did. My application had to support different cultures. So I simply set the required culture on my application’s current thread like this Then I noticed that worker threads, that I am using somewhere during the application runtime, don’t know anythi…

By Mirek on (tags: CultureInfo, localization, thread, categories: code)

Localized enums with Entity Framework Code-First 4.1 in WPF MVVM and ASP.NET MVC 3. Part 2)

  Part 2. Displaying localized names of enum values in WPF application To achieve the human readable enums I have performed following steps. For each language I want to support I have added a resource (.resx) file with key equals the string representation of the enum value.   Then we decorate our enum values with Display attribute as follows As a description we can pr…

By Mirek on (tags: ASP.NET MVC, Code First, Entity Framework, enums, localization, mvvm, WPF, categories: code)

Localized enums with Entity Framework Code-First 4.1 in WPF MVVM and ASP.NET MVC 3

In part 1) I would like to present the solution of using enum types with Entity Framework Code-First (EF CF later). Then in part 2) I would like to show how easily display these enums in WPF MVVM and in Part 3)  I will try to explain my approach for displaying and binding localized enums in ASP.NET MVC 3 application. EF CF approach is still developed and in version 4.1 it …

By Mirek on (tags: ASP.NET MVC, Code First, Entity Framework, enums, localization, mvvm, WPF, categories: code, web)