I have a question and a problem.
First off, I am trying to separate the login screen language and the application language — so that when a user logs out in German, the login screen is in English (or vice versa) and when he logs in, it doesn't revert the application language to English for the aforementioned user.
Seems rather simple, but I can't understand why cookies are responsible for changing the language. In the language-switch
component, there is this code in topbar
component:
this._customSettingsService.changeLanguage(languageName)
.subscribe(() => {
abp.utils.setCookieValue(
"Abp.Localization.CultureName",
languageName,
new Date(new Date().getTime() + 5 * 365 * 86400000), // 5 years
abp.appPath
);
window.location.reload();
});
When I comment out the abp.utils.setCookieValue
, the language does not switch, which does not make any sense whatsoever.
Important note: I changed the ngOnInit()
function in app.component
, so that current and user languages are read from the DB dbo.AbpSettings
and are changed accordingly.
Any clarification would be very helpful.
From the documentation on Localization:
How the Current Language is Determined 🔗
ASP.NET MVC 5.x 🔗
ABP automatically determines the current language in every web request and sets the current thread's culture (and UI culture). This is how ABP determines it by default. ABP will:
...
Try to get it from a special cookie value, named "Abp.Localization.CultureName" by default.