简体   繁体   中英

Globalization in asp.net core

I read articles about globalizing asp.net core application. All of them suggests to create 'Resources' folder and create sub folders and for each Controller/View/ViewModel, create resource file for each language. Is there a better way to do this, just having one resource file per language? If yes, what change I need to make in startup.cs file?

Is there a better way to do this, just having one resource file per language?

Globalization with help of SharedResource, you could refer to the below:

  1. SharedResource.cs , put it in the root folder of project and it does not need to contain any data, just the class declaration.

  2. create a resource file called the same as the.cs file and it needs to be put in the Resources folder. 在此处输入图像描述

For the usage of SharedResource file, you could refer to below links:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1

ASP.NET Core Localization with help of SharedResources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM