The Wayback Machine - https://web.archive.org/web/20220121222134/https://github.com/dotnet/aspnetcore/issues/39689
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 6.0.101 ASP.NET MVC globalization and localization is not working #39689

Open
1 task done
rramoscabral opened this issue Jan 21, 2022 · 0 comments
Open
1 task done

.NET 6.0.101 ASP.NET MVC globalization and localization is not working #39689

rramoscabral opened this issue Jan 21, 2022 · 0 comments

Comments

@rramoscabral
Copy link

@rramoscabral rramoscabral commented Jan 21, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

.NET 6.0.101 ASP.NET Core Web App (Model-View-Controller) globalization and localization is not working
The ResourcePath/option.ResourcesPath value defined in Microsoft.Extensions.Localization.LocalizationOption is always in blank.

I used the following template 'ASP.NET Core Web App (Model-View-Controller)'

Code used

builder.Services.AddLocalization(option => { option.ResourcesPath = "Resources"; });
builder.Services.AddMvc().AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix).AddDataAnnotationsLocalization();

or

builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
builder.Services.AddMvc().AddViewLocalization(Microsoft.AspNetCore.Mvc.Razor.LanguageViewLocationExpanderFormat.Suffix).AddDataAnnotationsLocalization();

Expected Behavior

Recognize the resources folder and resources files like /Resources/View/Home/Index.en.resx

Steps To Reproduce

In Visual Studio:

  1. Create a new ASP.NET Core Web App (Model-View-Controller) project
  2. Define:
  • Framework: .NET 6.0 (Long-term support)
  • Authenticate type: Individual Account
  • Configure for HTTPS: enabled
  1. Create
  2. Define globalization and localization
  3. Create resource folder and files
  4. Testing

Exceptions (if any)

No response

.NET Version

6.0.101

Anything else?

ASP.NET Core version: p 6.0.1
IDE: VS & VS Code
OS Version: 10.0.19044

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant