Git Product home page Git Product logo

jonpsmith / net.localizemessagesanderrors Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 0.0 1.19 MB

This library provides extra code to make it easier to support in different languages in your .NET application

Home Page: https://www.thereformedprogrammer.net/improving-the-support-of-multiple-languages-in-net-applications/

License: MIT License

C# 93.48% HTML 5.88% CSS 0.52% JavaScript 0.11%
localization multilingual globalization status genericstatus

net.localizemessagesanderrors's Introduction

Net.LocalizeMessagesAndErrors

This library provides extra code to make it easier to support in different languages in your .NET application (known as localization in .NET). The code in this library wraps the .NET's localization services with a nicer front-end that makes the localization parts easier to code and understand. Its especialy useful if you are creating a library, as the library can be tried straight away without having to set up ASP.NET Core's localization.

This library is an open-source library under the MIT licence and the NuGet package can be found here. The documentation can be found in the GitHub wiki and see ReleaseNotes for details of changes.

List of versions and which .NET framework they support

The versions of this library has changed to make it easier to create a new version when a new release of .NET farmework. Now the first number defines the .NET version, e.g EfCore.TestSupport version 8.?.? only runs on .NET 8.

  • Version 2.?.?: Supports NET 6, 7 and 8
  • Version 1.0.?: Supports NET 6 and 7

Why I built this library

A user of the of my library AuthPermissions.AspNetCore (shortened to AuthP) wanted support for multiple languages (known as localization) added. I looked at the .NET localization service and here the main issues I had:

  1. Makes your code harder to understand: The .NET's Localization replaces the message string to represent a message, which makes the code harder to understand, e.g. the error message “When using sharding the the hasOwnDb parameter must not be null.” would become a key something like “ShardingHasOwnDb”.
  2. Makes it harder add localization to an existing app: Localization isn’t usually added at the start of a project (see MVP - Minimum Viable Product approach) so you most likely have code with messages built into your code at to start. .NET's Localization requires to remove the messages in your code and put them in the resource files - that's a lot of work.
  3. Missing localized messages doesn't provide a good user experience: If you don't add a localizes message to the resource files, the the .NET localisation shows the key, e.g. “ShardingHasOwnDb”, which isn’t that useful to a user.
  4. Makes a NuGet library hard to use / understand: Using a NuGet library that uses .NET's Localization would force you to set up the localization and it's resource files, which instantly makes the library hard to setup and understand.

It took me some time to design a library called Net.LocalizeMessagesAndErrors that solves issues above (and more). Plus, using the library on my AuthP library (which has hundreds of errors / messages) provides lots feedback on the best design for the library.

You can find list of the improvements that this library provides better handling localization in .NET applications.

net.localizemessagesanderrors's People

Contributors

jonpsmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.