Hi @Ronaldo Ademar ,
Is there any way to add Haitian Creole to my list of cultures? Since it is not in the list of supported languages?
Do you mean display the Haitian Creole
in the cultures select DropDownList?
From the official document and its sample code, we can see that it, in the Views/Shared/_SelectLanguagePartial.cshtml
file, we could get the supported cultures via the IOptions<RequestLocalizationOptions>
, then use a select
element to display the culture.
Then, to change the Unknown Language (ht)
to Haitian Creole
, you can modify the query statement as below:
Besides, if you want to add custom language and culture, you could use a custom provider, and add it via the AddInitialRequestCultureProvider method, refer to the following code:
private const string enUSCulture = "en-US";
services.Configure<RequestLocalizationOptions>(options =>
{
var supportedCultures = new[]
{
new CultureInfo(enUSCulture),
new CultureInfo("fr")
};
options.DefaultRequestCulture = new RequestCulture(culture: enUSCulture, uiCulture: enUSCulture);
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
options.AddInitialRequestCultureProvider(new CustomRequestCultureProvider(async context =>
{
// My custom request culture logic
return await Task.FromResult(new ProviderCultureResult("en"));
}));
});
More detail information, see Use a custom provider and Writing a Custom Request Culture Provider.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion