web: fix locale inconsistencies (#4888)

start fixing locale inconsistencies

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L
2023-03-09 23:57:54 +01:00
committed by GitHub
parent d11ee46589
commit 9b8c0e3924
6 changed files with 64 additions and 32 deletions

View File

@ -50,10 +50,14 @@ export class AKElement extends LitElement {
get activeTheme(): UiThemeEnum | undefined {
return this._activeTheme;
}
private _handleLocaleChange: () => void;
constructor() {
super();
this.addEventListener(EVENT_LOCALE_CHANGE, this._handleLocaleChange);
this._handleLocaleChange = (() => {
this.requestUpdate();
}).bind(this);
window.addEventListener(EVENT_LOCALE_CHANGE, this._handleLocaleChange);
}
protected createRenderRoot(): ShadowRoot | Element {
@ -147,11 +151,7 @@ export class AKElement extends LitElement {
disconnectedCallback() {
super.disconnectedCallback();
this.removeEventListener(EVENT_LOCALE_CHANGE, this._handleLocaleChange);
}
private _handleLocaleChange() {
this.requestUpdate();
window.removeEventListener(EVENT_LOCALE_CHANGE, this._handleLocaleChange);
}
}

View File

@ -66,11 +66,15 @@ export class AggregateCard extends AKElement {
: ""}`;
}
renderHeader(): TemplateResult {
return html`${this.header ? this.header : ""}`;
}
render(): TemplateResult {
return html`<div class="pf-c-card pf-c-card-aggregate">
<div class="pf-c-card__header pf-l-flex pf-m-justify-content-space-between">
<div class="pf-c-card__title">
<i class="${ifDefined(this.icon)}"></i>&nbsp;${this.header ? this.header : ""}
<i class="${ifDefined(this.icon)}"></i>&nbsp;${this.renderHeader()}
</div>
${this.renderHeaderLink()}
</div>