ईवेंट्स
Power BI DataViz World Championship
14 फ़र॰, 4 pm - 31 मार्च, 4 pm
प्रवेश करने के 4 अवसरों के साथ, आप एक सम्मेलन पैकेज जीत सकते हैं और लास वेगास में लाइव ग्रैंड फिनाले में जगह बना सकते हैं
अधिक जानेंयह ब्राउज़र अब समर्थित नहीं है.
नवीनतम सुविधाओं, सुरक्षा अपडेट और तकनीकी सहायता का लाभ लेने के लिए Microsoft Edge में अपग्रेड करें.
This article provides instructions on how to diagnose ASP.NET Core app localization issues.
Localization middleware order
The app may not localize because the localization middleware isn't ordered as expected.
To resolve this issue, ensure that localization middleware is registered before MVC middleware. Otherwise, the localization middleware isn't applied.
public void ConfigureServices(IServiceCollection services)
{
services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddMvc();
}
Localization resources path not found
Supported Cultures in RequestCultureProvider don't match with registered once
ASP.NET Core has predefined rules and guidelines for localization resources file naming, which are described in Globalization and localization in ASP.NET Core.
Common causes of resources not being found include:
.resx
) or the localizer request.Debug
log level) for more details about the missing resources.युक्ति
When using CookieRequestCultureProvider, verify single quotes aren't used with the cultures inside the localization cookie value. For example, c='en-UK'|uic='en-US'
is an invalid cookie value, while c=en-UK|uic=en-US
is valid.
ASP.NET Core by default provides a way to allow the class libraries to find their resource files via ResourceLocationAttribute.
Common issues with class libraries include:
The RequestLocalizationOptions class has three default providers:
The CustomRequestCultureProvider allows you to customize how the localization culture is provided. The CustomRequestCultureProvider is used when the default providers don't meet your requirements.
A common reason for a custom provider not working properly is that it isn't the first provider in the RequestCultureProviders list. To resolve this issue:
Insert the custom provider at position zero in the RequestCultureProviders list:
options.AddInitialRequestCultureProvider(
new CustomRequestCultureProvider(async context =>
{
// My custom request culture logic
return new ProviderCultureResult("en");
}));
Insert the custom provider at position zero in the RequestCultureProviders list:
options.RequestCultureProviders.Insert(0,
new CustomRequestCultureProvider(async context =>
{
// My custom request culture logic
return new ProviderCultureResult("en");
}));
When the root namespace of an assembly is different than the assembly name, localization doesn't work by default. To avoid this issue use the RootNamespace
attribute, which is described in Globalization and localization in ASP.NET Core.
चेतावनी
A root namespace issue can occur when a project's name isn't a valid .NET identifier. For instance, my-project-name.csproj
uses the root namespace my_project_name
and the assembly name my-project-name
, which results in this error.
If you use resource files for localization, it's important that they have an appropriate build action. Use Embedded Resource; otherwise, the ResourceStringLocalizer
isn't able to find these resources.
When using the location override using the Sensors pane in Google Chrome or Microsoft Edge developer tools, the fallback language is reset after prerendering. Avoid setting the language using the Sensors pane when testing. Set the language using the browser's language settings.
For more information, see Blazor Localization does not work with InteractiveServer (dotnet/aspnetcore
#53707).
ASP.NET Core प्रतिक्रिया
ASP.NET Core एक ओपन सोर्स प्रोजेक्ट है. प्रतिक्रिया प्रदान करने के लिए लिंक का चयन करें:
ईवेंट्स
Power BI DataViz World Championship
14 फ़र॰, 4 pm - 31 मार्च, 4 pm
प्रवेश करने के 4 अवसरों के साथ, आप एक सम्मेलन पैकेज जीत सकते हैं और लास वेगास में लाइव ग्रैंड फिनाले में जगह बना सकते हैं
अधिक जानेंप्रशिक्षण
मॉड्यूल
ASP.NET Core का उपयोग करके पहुँच योग्य वेब अनुप्रयोग बनाएँ - Training
किसी ASP.NET कोर अनुप्रयोग में सामान्य वेब पहुँच क्षमता समस्याओं का निदान करें और उन्हें ठीक करें.
दस्तावेज़ीकरण
Make an ASP.NET Core app's content localizable
Learn how to make an ASP.NET Core app's content localizable to prepare the app for localizing content into different languages and cultures.
Configure portable object localization in ASP.NET Core
This article introduces Portable Object files and outlines steps for using them in an ASP.NET Core application with the Orchard Core framework.
Provide localized resources for languages and cultures in an ASP.NET Core app
Learn how to provide localized resources for localizing content of an ASP.NET Core app into different languages and cultures.
Strategies for selecting language and culture in a localized ASP.NET Core app
Learn how to select a language and culture when localizing content into different languages and cultures in an ASP.NET Core app.