Globalization & Localization in .NET 6
Introduction
Globalization is the process of designing and developing applications that function for multiple cultures.
Localization is the process of customizing your application for a given culture and locale.
Cultures and Locales
The language needs to be associated with the particular region where it is spoken, and this is done by using locale (language + location). For example: fr is the code for French language. fr-FR means French language in France. So, fr specifies only the language whereas fr-FR is the locale. Similarly, fr-CA defines another locale implying French language and culture in Canada. If we use only fr, it implies a neutral culture (i.e., location neutral).
Prerequisites
- Visual Studio 2022 any edition.
- .NET 6SDK.
Resource Files
- A resource file is an XML file that contains the strings that you want to translate into different languages or paths to images.
- The resource file contains key/value pairs. Each pair is an individual resource. Key names are not case sensitive.
e.g. A resource file might contain a resource with the key Button1 and the value Submit
Resource files in ASP. NET have an .resx extension. At run time, the .resx file is compiled into an assembly.
Create Service
Create service to get the value from the resource files
Changes in Layout and Create a new partial view
Thank you
GitHub Link : Net6.Globalization
I hope you like the article. In case, you find the article interesting then kindly like and share it.