Search⌘ K
AI Features

Views Localization

Explore how to implement views localization in ASP.NET Core MVC by using resource files for culture-specific translations. Learn to organize resource files, enable localization in the startup configuration, and inject translation services into views to manage multi-language support effectively.

When a view contains a few strings to localize, or when the HTML structure is too complex to be duplicated in several culture-dependent views, we can use resource files that furnish the translations of the view strings.

Enabling resource files based localization

Resource-file-based localization associates each view culture-specific resource to files containing the translations in all supported cultures. The names of these resource files are composed of the name of the view, a culture name suffix, and the .resx extension that characterizes all resource files.

Thus, the resource files associated with the _Layout.cshtml view might be:

Shell
_Layout.es.resx
_Layout.fr.resx
_Layout.it.resx

Usually, there is no resource file associated with the ...