load the initial language first from the 'lang' attribute, then from the document, and lastly default 'en-us'

This commit is contained in:
Jacob Overgaard
2023-08-11 10:51:34 +02:00
parent 84e9eda294
commit 7c6fda21bd

View File

@@ -23,19 +23,6 @@ export class UmbAppElement extends UmbLitElement {
@property({ type: String })
serverUrl = window.location.origin;
/**
* The default culture to use for localization.
*
* When the current user is resolved, the culture will be set to the user's culture.
*
* @attr
* @remarks This is the default culture to use for localization, not the current culture.
* @example "en-us"
* @example "en"
*/
@property({ type: String, attribute: 'default-culture' })
culture: string = 'en-us';
/**
* The base path of the backoffice.
*
@@ -89,7 +76,8 @@ export class UmbAppElement extends UmbLitElement {
}
#setLanguage() {
umbTranslationRegistry.loadLanguage(this.culture);
const initialLanguage = this.lang || document.documentElement.lang || 'en-us';
umbTranslationRegistry.loadLanguage(initialLanguage);
}
#listenForLanguageChange(authContext: UmbAuthContext) {