Localization in ASP.NET 5 MVC 6

There is already a 7th beta version of ASP.NET 5, in which, they said, localization functions are implemented. How can I use localization to write multilingual applications in asp.net 5 mvc 6 with visual studio 2015? Is there any working example for the beta version? I have already searched and found many examples, but they no longer work because the code has been modified since then. Can I still use .resx files (because visual studio no longer generates Designer.cs files) or are there any newer or alternative methods that they offer?

+4
source share
1 answer

Beta 7 introduced localization, so it's really new. I wrote a short note about everything that was new on my blog . There are many new things, so if you need features, I recommend reading them.

In fact, you can still use Resx anyway, but you should understand that the default resolution is that the engine tries to find a resx file that matches the view.

For example, if you have an HomeControlleraction called Locpage, you need to have Views.Home.Locpage.cshtml.en-GB.resxEN-GB to support the local language. The best part, however, is that you no longer need the resx file :-). You can just implement your own implementation IStringLocalizerand IStringLocalizerFactory, and it will work. You can see the code for this on my blog above.

, GitHub, : https://github.com/aspnet/Mvc/tree/dev/samples/LocalizationSample.Web.

+7

Source: https://habr.com/ru/post/1606302/


All Articles