I've been Following this tutorial "https://www.youtube.com/watch?v=Hy9G30nncMM". with my own modifications.
ConfigureServices:
services.AddLocalization(opt => { opt.ResourcesPath = "Resources"; });
services.AddMvc().AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
.AddDataAnnotationsLocalization();
services.AddControllersWithViews();
Configure:
var supportedCultures = new[] {"en","ar"};
var localizationOptions = new RequestLocalizationOptions()
.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);
app.UseRequestLocalization(localizationOptions);
Folder Hierarchy:
Result:
Even that i set the default culture to supportedCultures[0] which is "en", the app gets the "ar".

Any Help on this matter would be appreciated. Thanks in Advance.


By default Asp.Net Core uses below
RequestCultureProvidersin order to detect the request culture:QueryStringRequestCultureProviderCookieRequestCultureProviderAcceptedLanguageHeaderRequestCultureProviderSo, depending on the supported cultures list provided in startup, it will try to match cultures in the list by the request culture in the providers till it find the first match and respond accordingly.
e.g.:
enandaras supported culture list,arasDefaultRequestCulture?culture=xxSo the localization middleware will first try with query string, but since there is no culture defined there, it will check the next provider
CookieRequestCultreProvider(below is a sample culture cookie forTRculture.)and if there is no culture param in the cookie it will check the last culture provider
AcceptedLanguageHeaderRequestCultureProviderwhich provides a list of accepted cultures.Below you can see a screenshot of chrome supported cultures list, you may change the order of your browsers cultures and see how it affect the request culture.
If it can't detect the request culture in any of the above providers then it will use the
DefaultRequestCulturethat has been defined inRequestLocalizationOptionsin startup.In most cases we may insert
RouteDataRequestCultureProviderat0position to provide culture in the route data, so it will be the first provider to look at during request localization:or