We've seen in the previous chapter that ASP.NET Coreincludesbuilt-in mechanisms for displaying resources in different languages; this definitely includes views. Actually, there are two ways to display translated texts, as follows:
- Resources
- Translated views
Let's start with resources.
Using resources
So, let's assume we have a couple of resource files (.resx), for languages PT and EN. Let's store them under the Resources folder (this can be configured, as we'll see in a moment), underneath a folder called Views, and inside a folder named after the controller the views are to be served from (say, Home, for example). The filenames themselves must match the action names—so, for example, we might have the following:
- Resources\Views\Home\Index.en.resx
- Resources\Views\Home\Index.pt.resx