Similar Posts

Leave a Reply

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


  1. HI there, nice article.
    And how about if we want to use the same files for the client side (in a react/angular) project ?
    Thank you. Nice Work!

    1. Hi, Ideally you would always have a different set of language files for client and server projects. But in cases, as you mention, it would make more sense to expose some kind of language service to which both the client and server app has access. You could also consider using the database to store translations and caching it as mentioned in the article. But I would always prefer to have separate resource files as server and client apps are always 2 different entities that should not share anything.


  2. How does this work with display data annotation attributes and view models and error messages

    1. Hi, you can create an empty .cs class, for example Locales.cs. Then you can put your localization files under this file.
      So, for example:
      -> Localizations(folder)
      -> Locales.cs
      -> Locales.en-US.json
      You can put JsonStringLocalizerFactory.cs and JsonStringLocalizer.cs anywhere, just change paths in JsonStringLocalizer.cs.
      LocalizationMiddleware.cs file is not necessary, because if you send lang in ‘Accept-Language’ header then Culture change automatically.