Learn how to build multilingual applications in .Net by leveraging the framework's built-in support for globalization Globalization and localization are two important concepts in .Net that help you to internationalize your applications. While globalization is the process that is used to build applications targeted at various cultures, localization is the process that is used to customize your application to provide support for a particular culture and locale. The steps to internationalize your application in .Net include the following: Identify the localizable resources Create resource files for each locale your application needs to provide support for Read the resource data in your application wherever applicable Compile the resource files to create satellite assemblies (one for each locale your application supports) Deploy your application To implement localization in your applications, you should take advantage of the following namespaces: System.Globalization — types that are used to culture-specific information System.Resources — types that are used for creating, manipulating, and using resources System.Text — types that are used to represent ASCII, Unicode and ANSI character encodings System.Threading — types that are used to work with multi-threading Resource files A resource is a piece of non-executable data that your application takes advantage of often. Typical examples of resources include locale specific strings, bitmaps, icons, cursors, etc. Such resources are stored in files known as resource files. To internationalize your application using .Net, you would need to take advantage of resource files. Resource files are used to store data specific to a particular locale. Note that resource files are XML files that can store binary information as well — the binary resources are actually base64 encoded. Ideally, you would have a separate resource file for each locale, i.e., one resource file per locale. Typically, your application can then read data from the resource files based on the locale your application is using and then display information pertaining to that locale to the user. Resources used for globalization in .Net can be of two types. These include the following: Local resources — used by a particular Web page, i.e., such resources are Web page specific Global resources — used by the entire application — all the Web pages of your application can leverage such resources Creating resource files You can create resource files using the Visual Studio IDE or even programmatically. To create a resource file in the Visual Studio IDE follow these steps. Open Visual Studio IDE in your system Click on File -> New -> Project to create a new web project In the Solution Explorer window, select your project and then right click on it Click Add -> New Item Select General from the list of the installed templates displayed in the window that pops up Select “Resources File” to create a file for storing the resources you need. The name of the file should indicate the locale it is targeted at Lastly, specify a name for your resource file and click OK A new resource file would now be created and added to your project in the name you specified – the extension of this file would be .resx. When naming your resource file, you can follow any one of the following conversions: resourcefilename.language.resx resourcefilename.language-locale.resx If you are creating global resources, i.e., resources that would be used by the entire application, you can place them inside the App_GlobalResources – if there isn’t one available you can just create one for you. Once your resource file has been created, you can add data in your resource file using the Resource Designer window. To access the culture specific resources, you can leverage the System.Resources.ResourceManager class. After you are done adding the necessary data to one or more resource files for your project, you can build your solution to generate the satellite assemblies for your project. A satellite assembly is a special type of an assembly in .Net that comprise of resources like, locale specific strings, bitmaps, icons, etc. You can also create a satellite assembly using the assembly linker command line tool Al.exe by running the Developer Command Prompt window in administrator mode. You can refer to this link for more information on this tool. Related content how-to How to use FastEndpoints in ASP.NET Core Take advantage of the free open-source FastEndpoints library to build fast and lean APIs in your ASP.NET Core applications. By Joydip Kanjilal Jul 11, 2024 7 mins Microsoft .NET C# Development Libraries and Frameworks how-to How to use Refit to consume APIs in ASP.NET Core Take advantage of Refit REST library to simplify API consumption and make your code cleaner, more efficient, and easier to maintain. By Joydip Kanjilal Jul 04, 2024 10 mins C# Microsoft .NET Software Deployment how-to When to use an abstract class vs. interface in C# Understanding the differences between an abstract class and interface is key to designing loosely coupled and extensible applications. By Joydip Kanjilal Jun 20, 2024 10 mins Small and Medium Business Microsoft .NET C# how-to 6 security best practices for ASP.NET Core Learn the best practices and built-in safeguards for preventing attacks and protecting sensitive data in your ASP.NET Core web applications. By Joydip Kanjilal Jun 07, 2024 6 mins C# Microsoft .NET Web Development Resources Videos