Similar Posts

Leave a Reply

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


  1. Hey, greate article… but how will that work if you would have the Resource Files within its own class library?

    1. Hi, Thanks.
      You could have a new assembly that serves the resources only. And use this assembly in the registration to load.
      Or, probably have the library return in terms of keys, so that you can translate in the core app itself.

      Thanks and regards

      1. Hey, thanks for the quick response. I think this is currently really tricky and it is also mentioned as an issue/troubleshoot on the official documentation (–class-libraries-issues) …

        it think the only problem would be on the registration process within the service collection where you register the ResourcePath… I am already looking for a while for a solution but haven´t found one yet.

        I have currently an ASP.NET Core 3.1 API Project which implements the CQRS Pattern and IMEDIATR Pattern and therefor I would like to place all resources within its own library… dont know if this will be possible… maybe with this ResourceLocationAttribute somehow…

        Best Regards

  2. Nice & helpful ! Thanks !
    One remark tho, I think you went a bit far with the translation (maybe for the purpose of the demo); the language picker should not be globalized but rather each language should appear as the natives write it. If one doesn’t know either English or the Latin characters, hitting the default ‘en’ page with the ‘en’ translated language picker would transform into a guessing game until they manage to get right the “hieroglyph sequence” that means their language 🙂

    1. Hi, Thanks for the feedback.
      Haha, yeah. I would say this is more of a tutorial that states the capabilities of a features. Implementation totally depends on the developer / client.
      Thanks and Regards

  3. Great & so helpful !
    But I have a question, how can I create a new cookie?
    please I am waiting your answer.

  4. Hi Mukesh, great article.
    I have one question, is it required ResourcesPath = “Resources” or can have ResourcesPath = “LocalizationResources”. Asking because having “Resources” having conflict.

  5. Thanks for the guide, Mukesh.

    Could you explain how to localize models – i.e. store all of the properties of the model in multiple languages and display the correct version with the correct langauge?

    For example, you have an online shop, and you want to be able to display product details in English and French. What’s the best way to handle this (particularly with regard to data structure?)

    1. public class EditProfileModel
      [Display(ResourceType = typeof(Resources.Accounts), Name = “Register_FullNameField”)]
      public string FullName { get; set; }

  6. Very good tutorials. Keep it that way.
    I have only one question: if I want to keep all the translations in one file for each culture? (Ex: shared_resource.en.resx)

  7. The article is simply great. It is easy to implement. I have a question regarding WebAPI. I have a separate project of WebAPI in .net Core. How to pass the selected culture from this web application to WebAPI project. I don’t want to send via query string. How to pass it through request headers or some other way.

  8. Hi, thanks for the great article but I have a question about the best approach to take: Whether to send localized strings to view through a view model or use View Localisation directly in the views. Thanks in advance.

  9. How to send and figure out the culture of a web api request for return correspond message strings from recourse files?

  10. Very good Mukesh,
    For .Net core 6, here is a fix for Program.cs

    builder.Services.AddLocalization(options => options.ResourcesPath = “Resources”);

    builder.Services.Configure(options =>
    var cultures = new List {
    new CultureInfo(“en”),
    new CultureInfo(“fr”)
    options.DefaultRequestCulture = new Microsoft.AspNetCore.Localization.RequestCulture(“en”);
    options.SupportedCultures = cultures;
    options.SupportedUICultures = cultures;
    var app = builder.Build();
    var options = app.Services.GetRequiredService<IOptions>();

  11. Hi Mukesh,
    We have implemented this and works fine in Dev environment and we have deployed in Linux – Nginx .When i try to change the language, it does not work in linux environment.Do i need to do any configuration for this.please advice.

  12. Hi Mukesh,

    Can you please guide how to deploy this in linux environment as i have deployed and i am facing some challenges while changing the language.

  13. I have implemented same code in my POC application its run properly but in my working project its not works what is the resason?

  14. Hi Mukesh, I was stuck on somewhere on making my website to work on url based localization and found out that your solution is really good.
    only thing I wants if you can update the code base to latest version of .net core 8.0 will be helpful for many.