Similar Posts

Leave a Reply

Your email address will not be published.

20 Comments

  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 asp.net 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 (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/troubleshoot-aspnet-core-localization?view=aspnetcore-3.1#resources–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?