Culture based views in ASP.NET Core

ASP.NET Core supports culture based views for more complex localizations. It means we have one view per culture per controller action. This blog post shows how to use culture based views in ASP.NET Core and how to implement them.

Sample solution. Working code introduced here and in my blog post ASP.NET Core: Simple localization and language based URL-s is available in GitHub repository gpeipman/AspNetCoreLocalization.

Adding culture based views

Culture based views in solution explorerCulture based views can be organized in views folder two ways:

  1. using subfolders – controller views folder has subfolders named by culture and each of these folders contains views for given culture,
  2. using culture suffix – culture is specified in the end of view name, just before file extensions.

The screen fragment on right shows how Contacts view has both localizations applied. For Estonian culture (et) there is subfolder and for Russian culture (ru) the culture is specifien in view name. For all other cases fallback to Contacts.cshtml is made.

Enabling view localization

Before creating views we need to add support for culture based views. For this we call AddViewLocalization() method on IMvcBuilder (it is not defined for services collection). If you are not using Microsoft.AspNetCore.All package then add NuGet reference to Microsoft.AspNetCore.Mvc.Localization package. The following code fragment comes from ConfigureServices() method of sample solution Startup class.

services.AddMvc()
        .AddDataAnnotationsLocalization(options =>
        {
            options.DataAnnotationLocalizerProvider = (type, factory) =>
                factory.Create(typeof(Common));
        })
        .AddViewLocalization(LanguageViewLocationExpanderFormat.SubFolder)
        .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix);

Notice LanguageViewLocalizationExpanderFormat enum and how we use it here to support views in culture based subfolders and views that have culture in their name. This is all I had to do to enable support for culture based views in sample solution.

Wrapping up

Culture based views are useful with more complex localization cases. Once localization is set up for web application it is easy to add support for culture based views. All we had to do was creating views using culture named folders or culture based view names and adding line of code to application start-up to notify ASP.NET Core that we use this feature.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    3 thoughts on “Culture based views in ASP.NET Core

    • Pingback:The Morning Brew - Chris Alcock » The Morning Brew #2528

    • April 21, 2025 at 3:41 pm
      Permalink

      As a man because you do not need to return off as a creep,’ she stated. Eastern European girls are at all times prepared to come back to the rescue. Among them, there are over 3000 single girls who have provided their self-introduction videos. On 19-20 May 2022 the 1st Girls ESTEAM Fest took place in a hybrid format (on-site and on-line). The latter adjustment could also be wanted as a result of the start of the civil calendar yr had not at all times been 1 January and was altered at completely different times in different nations. The entire phrase may be a reputation however, as males don’t simply “order” a wife like they are doing a dish. You lastly have joined a web-based relationship service and found the girl you really like? “I really feel like she is out of my league. By going to a site run by individuals who know what adults want on the subject of meeting folks, you cut out lots of the “gamers” on the market who are only concerned with a superb time for a short while.

      In the early phases, normally how you discover out if you actually are a pair, is whenever you meet his / her friends or family and how they introduce you. In conclusion, these searching for love and friendship will discover a thriving and diverse courting scene in Eastern Europe. To accommodate the two calendar adjustments, writers used twin relationship to identify a given day by giving its date based on both kinds of courting. Showing up late is an indication of disrespect and won’t sit effectively together with your date. It does not appear attainable however after you have experienced it, you will perceive. Free providers typically don’t require a bank card or other verifiable data that might make it attainable to establish a problem member. With its European borders protected from assault, Portugal was free to expand and explore other regions. The second distinction – which she flagged as the biggest – was that European males requested more about what they can do for her. However, for the period between the primary introduction of the Gregorian calendar on 15 October 1582 and its introduction in Britain on 14 September 1752, there may be considerable confusion between occasions in Continental Western Europe and in British domains.

      Up to now, many eastern European girls wed western men and yet, some of these have been widows who found a man in their region of the world. Events in Continental Western Europe are normally reported in English-language histories by utilizing the Gregorian calendar. Europe is extra conservative than the US, however more casual than Asia. In the US, it is close to non-existent, whereas in Asia it is extremely much so. Europeans are a lot quicker to start a relationship and if it doesn’t work out, then transfer on and begin one other solely. Such an strategy saves any relationship very well. Suggesting a spot you will have frequented and will be fairly comfortable in will not only take the edge off considerably for you, but may also in flip most likely put your date at ease as effectively. That maps to eleven July (Gregorian calendar), conveniently near the Julian date of the following (and more decisive) Battle of Aughrim on 12 July 1691 (Julian). The corresponding date in the Gregorian calendar is 9 February 1649, the date by which his contemporaries in some parts of continental Europe would have recorded his execution. In his CharmingDate biography of John Dee, The Queen’s Conjurer, Benjamin Woolley surmises that as a result of Dee fought unsuccessfully for England to embrace the 1583/84 date set for the change, “England remained exterior the Gregorian system for a further 170 years, communications throughout that period customarily carrying two dates”.

      In distinction, Thomas Jefferson, who lived whereas the British Isles and colonies transformed to the Gregorian calendar, instructed that his tombstone bear his date of start through the use of the Julian calendar (notated O.S. Who’s the satan-like creature naughty youngsters concern on Christmas morning in Austria? 3. Online relationship dk is filled with profiles that are fraud or people who are losers in life and discover these sites the reliable site would be a part of. Lastly, one other huge cross cultural difference in dating between Europe vs US is that Public Display of Affection (PDA) is completely regular in Europe. GoldenBride is an Eastern European dating site that connects males with charming and stunning ladies from Eastern Europe. Fall 2023 assertion of the Dating Committee on the present state of the economic exercise in the euro space. The O.S./N.S. designation is especially related for dates which fall between the start of the “historic yr” (1 January) and the legal start date, the place totally different. Dates alleged to be fun and speaking about jobs is not really thought of fun. European ladies typically recognize thoughtful and significant dates. Quality Over Quantity: Europeans generally prefer fewer, extra significant dates over numerous casual encounters.

    • May 29, 2025 at 10:56 am
      Permalink

      Hello there, I discovered your blog via Google whilst searching for a similar matter, your website came up, it seems great.
      I have bookmarked it in my google bookmarks.
      Hello there, just was aware of your blog via Google, and located that it’s really informative.
      I’m gonna be careful for brussels. I will appreciate
      for those who proceed this in future. Many other folks will be benefited
      from your writing. Cheers!

    Leave a Reply

    Your email address will not be published. Required fields are marked *