diff --git a/packages/app-shell/README.md b/packages/app-shell/README.md index d99df0121c2216acb51865f8e90aa381e00cbc47..17fce0bda628bcec137c7461b897cd17aed36632 100644 --- a/packages/app-shell/README.md +++ b/packages/app-shell/README.md @@ -36,6 +36,13 @@ The component emits `dbp-set-property` events for these attributes: - `lang` to propagate a language change (possible values `en`, `de`) - `requested-login-status` (possible values `logged-in`, `logged-out`) +### Emitted events + +#### dbp-lang + +The component emits a `dbp-lang` event when the language is changed (for example in the language picker). +The `details` attribute of the event is the language (possible values `en`, `de`). + ## Topic Metadata ```json diff --git a/packages/app-shell/src/app-shell.js b/packages/app-shell/src/app-shell.js index 04372c544ea3b87bfd9794f7a10cbb8a60afe3ce..4b99658f87ad156be1dc1c9c40c0445d8ce3433b 100644 --- a/packages/app-shell/src/app-shell.js +++ b/packages/app-shell/src/app-shell.js @@ -296,6 +296,14 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { this.router.update(); this.subtitle = this.activeMetaDataText("short_name"); this.description = this.activeMetaDataText("description"); + + // send a dbp-lang event with the language + const event = new CustomEvent('dbp-lang', { + bubbles: true, + composed: true, + detail: this.lang + }); + this.dispatchEvent(event); break; case 'metadata': {