Skip to content

ladinek82/OpenResxLocalization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The code implements a localization in ASP.NET Core 3+ by non-compiled RESX file.

How to integrate the OpenResxLocalization in your project

  1. Download a content of folder src and include the files into your project (change namespace ...)

  2. Initialization in Startup.cs in methode ConfigureServices

    services.AddOpenResxLocalization(options => options.ResourcesPath = "Resources");
    
  3. Create a folder with name 'Resources' in base project folder and in it create folders by typical localization steps (You have to use a path naming - Globalization and localization in ASP.NET Core)
    For example:
    resource folder structure

  4. Set properties of resx file

    • Build Action on Content
    • Copy to Output Directory on Copy always of on Copy if newer
      resx properties
  5. It is all.

My expirience with the OpenResxLocalization

  • It works with all type of localizations: in Controllers, in Views and in DataAnnotations.
  • It is possible to use it in desktop applications, web applications (ASP.NET) and libraries.
  • I don't have an expirience with hosting the code on Linux.



I have look for on the Internet libraries, nugets and articles on blogs where somebody solves this issue but I can not find anything. I have to create my own solution and I hope it helps you. If you have a tip for improvment, you will write it. I will pleasere.

Tips for you

  • OpenResxResourceManager uses XDocument for finding a localized value, because I have found an article where somebody write. The XDocument is faster than XmlDocument. There is both impelementation (XDocument is used and XmlDocument is commented)
  • OpenResxResourceManager has only one constructor but other constructors are commented.

Releases

No releases published

Packages

No packages published

Languages