Code Monkey home page Code Monkey logo

openresxlocalization's Introduction

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.

openresxlocalization's People

Contributors

ladinek82 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.