Table of content

How i18n works in .NET/MVC: If you are creating a .NET/MVC application with multilingual users, you would certainly want to localize your content. This overview explains how that can be achieved while developing in .NET.
.NET provides components to support i18n out of the box with the following features:
It can display content in different languages.
It autodetects the language from the user’s browser.
It allows the user to override the language of their browser.
Internationalization consists of Globalization, which is supporting multiple cultures, and Localization, which is customizing your application for a given culture.
ASP.NET keeps track of two culture values: Culture and UICulture. The Culture value determines the results of culture-dependent functions such as date, number, and currency formatting. The UICulture determines which resources are loaded for the page by the ResourceManager.
Localized content in .NET is stored in resource files (.resx extension), which are XML-based files containing keys and values. <data> tags represent keys, and values are stored inside <value> tags. Microsoft Visual Studio provides a visual editor for these files in a Key = Value format. The key is what the application uses to retrieve localized values.
This is one example of a resource file entry in its binary form:
Setup i18n in .NET/MVC
First, we need to determine Culture and UICulture. .NET can automatically detect this from the user’s browser via a web.config setting:
web.config culture configuration gist
Alternatively, you can store and manage user-selected Culture and UICulture via cookies.
Next, create resource files. Each file should clearly indicate its culture using this naming convention:
<resource-filename>.<culture>-<country_code>.resx
Example:
Messages.en-US.resx
This file would contain application messages translated into US English.
Set the access modifier of the resource file to Public if the resources should be accessible across multiple projects. Otherwise, they can remain private within the project.
Using i18n in .NET/MVC
Resource files are mostly used in views. Below is an example of referencing resource values in a view:
Resource files can either:
Live inside the same project, or
Be placed in a separate shared project and referenced by multiple projects.
Using i18n with interpolation
Often you need variables inside localized strings, such as:
“You have signed in as…”
This can be done using placeholders in resource strings:
SignedInText = "You have signed in as {0}"
Then use String.Format to inject values:
.NET interpolation with resources gist
Using i18n with pluralization
.NET resource files do not include built-in pluralization support. Therefore, pluralization logic must be implemented manually by the developer (for example, using conditional logic based on numeric values).
Related articles

i18n gem advanced features - Ruby on Rails internationalization
Find inside this article the highlighting of some i18n gem advanced features in Ruby on Rails internationalization.

i18n and l10n for AngularJS apps from development to deployment
Incorporating multiple languages into your app requires careful planning for adequate multilingual support. Read about i18n and l10n for AngularJS apps in our blog

PHP internationalization - i18n mechanisms tutorial
Looking for effective PHP internationalization with fewer hassles? We found the solution that will help you. Learn more inside our blog