Globalization & Localization in .NET 6

KANHAIYA TYAGI
2 min readNov 29, 2021

--

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

  1. Visual Studio 2022 any edition.
  2. .NET 6SDK.

Resource Files

  1. A resource file is an XML file that contains the strings that you want to translate into different languages or paths to images.
  2. 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.

Resource file

Create Service

Create service to get the value from the resource files

Service

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.

--

--

KANHAIYA TYAGI
KANHAIYA TYAGI

Written by KANHAIYA TYAGI

Engineer, GIS, .NET, JavaScript, jQuery, Azure, Angular

No responses yet