var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
// Add services to the container.
builder.Services.AddRazorPages();
*** .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization();
//------------------------------------------
https://www.youtube.com/watch?v=rRpLIytLtbQ Hello, I am making a website using c# razor page. I was doing localization by looking at the video below. But where I marked "***" I get the following error. Why do you think it might?
Eror:CS0103 The name 'AddViewLocalization' does not exist in the current context Same Line :CS1022 Type or namespace definition, or end-of-file expected
The website was considering adding language support. But it was not successful.
The code should be like the following:
builder.Services.AddRazorPages()
.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization();
Note that I have removed the semicolon ;
at the end of code line.