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 feature 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development feature Designing the APIs that accidentally power businesses Well-designed APIs, even those often-neglected internal APIs, make developers more productive and businesses more agile. By Jean Yang Nov 18, 2024 6 mins APIs Software Development news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages Resources Videos