import { EVENT_LOCALE_REQUEST } from "@goauthentik/common/constants"; import { customEvent } from "@goauthentik/elements/utils/customEvents"; import { localized, msg } from "@lit/localize"; import { LitElement, html } from "lit"; import { customElement } from "lit/decorators.js"; import "./ak-locale-context"; export default { title: "Elements / Shell / Locale Context", }; @localized() @customElement("ak-locale-demo-component") export class AKLocaleDemoComponent extends LitElement { render() { return html`${msg("Everything is ok.")}`; } } @localized() @customElement("ak-locale-sensitive-demo-component") export class AKLocaleSensitiveDemoComponent extends LitElement { render() { return html`

${msg("Everything is ok.")}

`; } } export const InFrench = () => html`
Everything is not ok.
`; export const SwitchingBackAndForth = () => { let lang = "en"; window.setInterval(() => { lang = lang === "en" ? "fr" : "en"; window.dispatchEvent(customEvent(EVENT_LOCALE_REQUEST, { locale: lang })); }, 1000); return html`
`; };