简体   繁体   中英

ASP.net core localization/resource issue

I'm building an ASP.net core project with few namespace, all my resx files are in the resources folder, localization for the views are working with no issues, but for the controllers not 100%.What I understand from Microsoft documentation is that the naming convention would be like:

namepsace MyProject.Controllers.SubNamespace {
  class MyController: Controller {
  }
}

The resx for this controller must reside under Resources/Controllers/SubNamespace/MyController.en.resx

But it's not working. Am I missing something.

I am using .net core 3.1 and I have a problem like you and I fix it with removing "_" in my project name.

My project name was "My Project"

Resource path was "My Project.Resources.My_Project.MyresourceFileName.resx"

I found out that when I debugged my project and I removed "_" from project>project properties> Application tab > Default Namespace

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