diff --git a/web/package.json b/web/package.json index e42822dcb..1c4898d42 100644 --- a/web/package.json +++ b/web/package.json @@ -12,9 +12,11 @@ }, "lingui": { "sourceLocale": "en", - "locales": [ - "en" - ], + "locales": ["en", "pseudo-LOCALE"], + "pseudoLocale": "pseudo-LOCALE", + "fallbackLocales": { + "pseudo-LOCALE": "en" + }, "compileNamespace": "ts", "catalogs": [ { @@ -68,7 +70,6 @@ "rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-copy": "^3.4.0", "rollup-plugin-cssimport": "^1.0.2", - "rollup-plugin-external-globals": "^0.6.1", "rollup-plugin-minify-html-literals": "^1.2.6", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-sourcemaps": "^0.6.3", diff --git a/web/rollup.config.js b/web/rollup.config.js index 803fab4fb..cc60e7f7a 100644 --- a/web/rollup.config.js +++ b/web/rollup.config.js @@ -5,12 +5,11 @@ import sourcemaps from "rollup-plugin-sourcemaps"; import typescript from "@rollup/plugin-typescript"; import cssimport from "rollup-plugin-cssimport"; import copy from "rollup-plugin-copy"; -import externalGlobals from "rollup-plugin-external-globals"; -import babel from '@rollup/plugin-babel'; -import replace from '@rollup/plugin-replace'; +import babel from "@rollup/plugin-babel"; +import replace from "@rollup/plugin-replace"; const extensions = [ - '.js', '.jsx', '.ts', '.tsx', + ".js", ".jsx", ".ts", ".tsx", ]; const resources = [ @@ -32,6 +31,11 @@ const resources = [ const isProdBuild = process.env.NODE_ENV === "production"; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function manualChunks(id) { + if (id.includes("locales")) { + const parts = id.split("/"); + const file = parts[parts.length - 1]; + return "locale-" + file.replace(".ts", ""); + } if (id.includes("node_modules")) { if (id.includes("codemirror")) { return "vendor-cm"; @@ -105,23 +109,19 @@ export default [ commonjs(), babel({ extensions, - babelHelpers: 'runtime', - include: ['src/**/*'], + babelHelpers: "runtime", + include: ["src/**/*"], }), replace({ - 'process.env.NODE_ENV': JSON.stringify(isProdBuild ? 'production' : "development"), + "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"), preventAssignment: true }), - externalGlobals({ - django: "django", - }), sourcemaps(), isProdBuild && terser(), ].filter(p => p), watch: { clearScreen: false, }, - external: ["django"] }, // Flow executor { @@ -140,22 +140,18 @@ export default [ commonjs(), babel({ extensions, - babelHelpers: 'runtime', - include: ['src/**/*'], + babelHelpers: "runtime", + include: ["src/**/*"], }), replace({ - 'process.env.NODE_ENV': JSON.stringify(isProdBuild ? 'production' : "development"), + "process.env.NODE_ENV": JSON.stringify(isProdBuild ? "production" : "development"), preventAssignment: true }), - externalGlobals({ - django: "django" - }), sourcemaps(), isProdBuild && terser(), ].filter(p => p), watch: { clearScreen: false, }, - external: ["django"] }, ]; diff --git a/web/src/django.d.ts b/web/src/django.d.ts deleted file mode 100644 index 66cfe6379..000000000 --- a/web/src/django.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -declare module "django" { - export = django; -} -declare namespace django { - function gettext(name: string): string; - function ngettext(singular: string, plural: string, count: number): string; - function gettext_noop(msgid: string): string; - function pgettext(context: string, msgid: string): string; - function interpolate(fmt: string, obj: unknown, named: boolean): string; -} diff --git a/web/src/elements/Expand.ts b/web/src/elements/Expand.ts index 6fba66b58..1343bd797 100644 --- a/web/src/elements/Expand.ts +++ b/web/src/elements/Expand.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import PFExpandableSection from "../../node_modules/@patternfly/patternfly/components/ExpandableSection/expandable-section.css"; @@ -26,7 +26,7 @@ export class Expand extends LitElement { - ${gettext(this.expanded ? this.textOpen : this.textClosed)} + ${this.expanded ? t`${this.textOpen}` : t`${this.textClosed}`} `; diff --git a/web/src/elements/Page.ts b/web/src/elements/Page.ts index cb22f36e9..2c5d4895c 100644 --- a/web/src/elements/Page.ts +++ b/web/src/elements/Page.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { LitElement } from "lit-element"; import { html, TemplateResult } from "lit-html"; @@ -15,9 +15,9 @@ export abstract class Page extends LitElement {

- ${gettext(this.pageTitle())} + ${t`${this.pageTitle()}`}

- ${description ? html`

${gettext(description)}

` : html``} + ${description ? html`

${t`${description}`}

` : html``}
${this.renderContent()}`; diff --git a/web/src/elements/Spinner.ts b/web/src/elements/Spinner.ts index ee37091cc..84ca4c199 100644 --- a/web/src/elements/Spinner.ts +++ b/web/src/elements/Spinner.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import PFSpinner from "@patternfly/patternfly/components/Spinner/spinner.css"; @@ -22,7 +22,7 @@ export class Spinner extends LitElement { return html` + aria-valuetext="${t`Loading...`}"> diff --git a/web/src/elements/Tabs.ts b/web/src/elements/Tabs.ts index ea6a25a01..4cc045c8b 100644 --- a/web/src/elements/Tabs.ts +++ b/web/src/elements/Tabs.ts @@ -4,7 +4,7 @@ import PFTabs from "@patternfly/patternfly/components/Tabs/tabs.css"; import PFGlobal from "@patternfly/patternfly/patternfly-base.css"; import AKGlobal from "../authentik.css"; import { CURRENT_CLASS } from "../constants"; -import { gettext } from "django"; +import { t } from "@lingui/macro"; @customElement("ak-tabs") export class Tabs extends LitElement { @@ -62,7 +62,7 @@ export class Tabs extends LitElement { const pages = Array.from(this.querySelectorAll("[slot^='page-']")); if (!this.currentPage) { if (pages.length < 1) { - return html`

${gettext("no tabs defined")}

`; + return html`

${t`no tabs defined`}

`; } this.currentPage = pages[0].attributes.getNamedItem("slot")?.value; } diff --git a/web/src/elements/cards/AggregateCard.ts b/web/src/elements/cards/AggregateCard.ts index 9407afff4..b1b7e7b8b 100644 --- a/web/src/elements/cards/AggregateCard.ts +++ b/web/src/elements/cards/AggregateCard.ts @@ -1,4 +1,3 @@ -import { gettext } from "django"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { ifDefined } from "lit-html/directives/if-defined"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; @@ -47,7 +46,7 @@ export class AggregateCard extends LitElement { return html`
- ${this.header ? gettext(this.header) : ""} + ${this.header ? this.header : ""}
${this.renderHeaderLink()}
diff --git a/web/src/elements/events/ObjectChangelog.ts b/web/src/elements/events/ObjectChangelog.ts index d7f4125c4..ee709d4d8 100644 --- a/web/src/elements/events/ObjectChangelog.ts +++ b/web/src/elements/events/ObjectChangelog.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Table, TableColumn } from "../table/Table"; @@ -44,10 +44,10 @@ export class ObjectChangelog extends Table { columns(): TableColumn[] { return [ - new TableColumn("Action", "action"), - new TableColumn("User", "enabled"), - new TableColumn("Creation Date", "created"), - new TableColumn("Client IP", "client_ip"), + new TableColumn(t`Action`, t`action`), + new TableColumn(t`User`, t`enabled`), + new TableColumn(t`Creation Date`, t`created`), + new TableColumn(t`Client IP`, t`client_ip`), ]; } @@ -56,7 +56,7 @@ export class ObjectChangelog extends Table { html`${item.action}`, html`
${item.user?.username}
${item.user.on_behalf_of ? html` - ${gettext(`On behalf of ${item.user.on_behalf_of.username}`)} + ${t`On behalf of ${item.user.on_behalf_of.username}`} ` : html``}`, html`${item.created?.toLocaleString()}`, html`${item.clientIp}`, @@ -76,9 +76,9 @@ export class ObjectChangelog extends Table { } renderEmpty(): TemplateResult { - return super.renderEmpty(html` + return super.renderEmpty(html`
- ${gettext("No matching events could be found.")} + ${t`No matching events could be found.`}
`); } diff --git a/web/src/elements/forms/ConfirmationForm.ts b/web/src/elements/forms/ConfirmationForm.ts index f340914dc..41d916382 100644 --- a/web/src/elements/forms/ConfirmationForm.ts +++ b/web/src/elements/forms/ConfirmationForm.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { EVENT_REFRESH } from "../../constants"; import { ModalButton } from "../buttons/ModalButton"; @@ -37,14 +37,14 @@ export class ConfirmationForm extends ModalButton { onSuccess(): void { showMessage({ - message: gettext(this.successMessage), + message: this.successMessage, level: MessageLevel.success, }); } onError(e: Error): void { showMessage({ - message: gettext(`${this.errorMessage}: ${e.toString()}`), + message: t`${this.errorMessage}: ${e.toString()}`, level: MessageLevel.error, }); } @@ -76,14 +76,14 @@ export class ConfirmationForm extends ModalButton { this.confirm(); }} class="pf-m-danger"> - ${gettext(this.action)} + ${this.action}   { this.open = false; }} class="pf-m-secondary"> - ${gettext("Cancel")} + ${t`Cancel`} `; } diff --git a/web/src/elements/forms/DeleteForm.ts b/web/src/elements/forms/DeleteForm.ts index 91154ca76..031ded926 100644 --- a/web/src/elements/forms/DeleteForm.ts +++ b/web/src/elements/forms/DeleteForm.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { EVENT_REFRESH } from "../../constants"; import { ModalButton } from "../buttons/ModalButton"; @@ -35,14 +35,14 @@ export class DeleteForm extends ModalButton { onSuccess(): void { showMessage({ - message: gettext(`Successfully deleted ${this.objectLabel} ${ this.obj?.name }`), + message: t`Successfully deleted ${this.objectLabel} ${ this.obj?.name }`, level: MessageLevel.success, }); } onError(e: Error): void { showMessage({ - message: gettext(`Failed to delete ${this.objectLabel}: ${e.toString()}`), + message: t`Failed to delete ${this.objectLabel}: ${e.toString()}`, level: MessageLevel.error, }); } @@ -51,7 +51,7 @@ export class DeleteForm extends ModalButton { return html`

- ${gettext(`Delete ${this.objectLabel}`)} + ${t`Delete ${this.objectLabel}`}

@@ -62,9 +62,7 @@ export class DeleteForm extends ModalButton {

- ${gettext( - `Are you sure you want to delete ${this.objectLabel} '${this.obj?.name}'?` - )} + ${t`Are you sure you want to delete ${this.objectLabel} '${this.obj?.name}'?`}

@@ -78,14 +76,14 @@ export class DeleteForm extends ModalButton { this.confirm(); }} class="pf-m-danger"> - ${gettext("Delete")} + ${t`Delete`}   { this.open = false; }} class="pf-m-secondary"> - ${gettext("Cancel")} + ${t`Cancel`} `; } diff --git a/web/src/elements/forms/ModalForm.ts b/web/src/elements/forms/ModalForm.ts index aaf42fe73..08fe12591 100644 --- a/web/src/elements/forms/ModalForm.ts +++ b/web/src/elements/forms/ModalForm.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { EVENT_REFRESH } from "../../constants"; import { ModalButton } from "../buttons/ModalButton"; @@ -66,7 +66,7 @@ export class ModalForm extends ModalButton { this.open = false; }} class="pf-m-secondary"> - ${gettext("Cancel")} + ${t`Cancel`} `; } diff --git a/web/src/elements/messages/MessageContainer.ts b/web/src/elements/messages/MessageContainer.ts index b4f6d2db2..5e9845b9c 100644 --- a/web/src/elements/messages/MessageContainer.ts +++ b/web/src/elements/messages/MessageContainer.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { LitElement, html, customElement, TemplateResult, property, CSSResult, css } from "lit-element"; import "./Message"; import { APIMessage, MessageLevel } from "./Message"; @@ -64,7 +64,7 @@ export class MessageContainer extends LitElement { if (this.retryDelay > 3000) { showMessage({ level: MessageLevel.error, - message: gettext("Connection error, reconnecting...") + message: t`Connection error, reconnecting...` }); } setTimeout(() => { diff --git a/web/src/elements/messages/Middleware.ts b/web/src/elements/messages/Middleware.ts index 320cdc74f..88ec39cc5 100644 --- a/web/src/elements/messages/Middleware.ts +++ b/web/src/elements/messages/Middleware.ts @@ -1,5 +1,5 @@ import { Middleware, ResponseContext } from "authentik-api"; -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { MessageLevel } from "./Message"; import { showMessage } from "./MessageContainer"; @@ -9,7 +9,7 @@ export class MessageMiddleware implements Middleware { if (context.response.status >= 500) { showMessage({ level: MessageLevel.error, - message: gettext("API request failed"), + message: t`API request failed`, description: `${context.init.method} ${context.url}: ${context.response.status}` }); } diff --git a/web/src/elements/notifications/APIDrawer.ts b/web/src/elements/notifications/APIDrawer.ts index 74d2db018..a14ff7030 100644 --- a/web/src/elements/notifications/APIDrawer.ts +++ b/web/src/elements/notifications/APIDrawer.ts @@ -5,7 +5,7 @@ import PFNotificationDrawer from "@patternfly/patternfly/components/Notification import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css"; import AKGlobal from "../../authentik.css"; import PFContent from "@patternfly/patternfly/components/Content/content.css"; -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { EVENT_API_DRAWER_REFRESH } from "../../constants"; export interface RequestInfo { @@ -71,7 +71,7 @@ export class APIDrawer extends LitElement {

- ${gettext("API Requests")} + ${t`API Requests`}

diff --git a/web/src/elements/notifications/NotificationDrawer.ts b/web/src/elements/notifications/NotificationDrawer.ts index a2edf65ba..c3ec51eab 100644 --- a/web/src/elements/notifications/NotificationDrawer.ts +++ b/web/src/elements/notifications/NotificationDrawer.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { EventsApi, Notification } from "authentik-api"; import { AKResponse } from "../../api/Client"; @@ -100,10 +100,10 @@ export class NotificationDrawer extends LitElement {

- ${gettext("Notifications")} + ${t`Notifications`}

- ${gettext(`${this.unread} unread`)} + ${t`${this.unread} unread`}

diff --git a/web/src/elements/oauth/UserCodeList.ts b/web/src/elements/oauth/UserCodeList.ts index ff7c99dff..f51ff7929 100644 --- a/web/src/elements/oauth/UserCodeList.ts +++ b/web/src/elements/oauth/UserCodeList.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Table, TableColumn } from "../table/Table"; @@ -26,9 +26,9 @@ export class UserOAuthCodeList extends Table { columns(): TableColumn[] { return [ - new TableColumn("Provider", "provider"), - new TableColumn("Expires", "expires"), - new TableColumn("Scopes", "scope"), + new TableColumn(t`Provider`, t`provider`), + new TableColumn(t`Expires`, t`expires`), + new TableColumn(t`Scopes`, t`scope`), new TableColumn(""), ]; } @@ -41,14 +41,14 @@ export class UserOAuthCodeList extends Table { html` { return new Oauth2Api(DEFAULT_CONFIG).oauth2AuthorizationCodesDelete({ id: item.pk || 0, }); }}> `, ]; diff --git a/web/src/elements/oauth/UserRefreshList.ts b/web/src/elements/oauth/UserRefreshList.ts index 66ede9214..5d9a52163 100644 --- a/web/src/elements/oauth/UserRefreshList.ts +++ b/web/src/elements/oauth/UserRefreshList.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Table, TableColumn } from "../table/Table"; @@ -26,9 +26,9 @@ export class UserOAuthRefreshList extends Table { columns(): TableColumn[] { return [ - new TableColumn("Provider", "provider"), - new TableColumn("Expires", "expires"), - new TableColumn("Scopes", "scope"), + new TableColumn(t`Provider`, t`provider`), + new TableColumn(t`Expires`, t`expires`), + new TableColumn(t`Scopes`, t`scope`), new TableColumn(""), ]; } @@ -41,14 +41,14 @@ export class UserOAuthRefreshList extends Table { html` { return new Oauth2Api(DEFAULT_CONFIG).oauth2RefreshTokensDelete({ id: item.pk || 0, }); }}> `, ]; diff --git a/web/src/elements/router/Router404.ts b/web/src/elements/router/Router404.ts index d04832511..51cdef1cb 100644 --- a/web/src/elements/router/Router404.ts +++ b/web/src/elements/router/Router404.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-state.css"; import PFTitle from "@patternfly/patternfly/components/Title/title.css"; @@ -18,11 +18,11 @@ export class Router404 extends LitElement { return html`
-

${gettext("Not found")}

+

${t`Not found`}

- ${gettext(`The URL '${this.url}' was not found.`)} + ${t`The URL '${this.url}' was not found.`}
- ${gettext("Return home")} + ${t`Return home`}
`; } diff --git a/web/src/elements/table/Table.ts b/web/src/elements/table/Table.ts index 05b6234c8..7d317a0e7 100644 --- a/web/src/elements/table/Table.ts +++ b/web/src/elements/table/Table.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult, html, LitElement, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; @@ -54,7 +54,7 @@ export class TableColumn { return html` `; } @@ -253,7 +253,7 @@ export abstract class Table extends LitElement { ${this.checkbox ? html` - { + { if ((ev.target as HTMLInputElement).checked) { this.selectedElements = this.data?.results || []; } else { diff --git a/web/src/elements/table/TablePage.ts b/web/src/elements/table/TablePage.ts index d0c0a2063..e3a429d15 100644 --- a/web/src/elements/table/TablePage.ts +++ b/web/src/elements/table/TablePage.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { ifDefined } from "lit-html/directives/if-defined"; @@ -34,9 +34,9 @@ export abstract class TablePage extends Table {

- ${gettext(this.pageTitle())} + ${t`${this.pageTitle()}`}

- ${description ? html`

${gettext(description)}

` : html``} + ${description ? html`

${t`${description}`}

` : html``}
diff --git a/web/src/elements/table/TablePagination.ts b/web/src/elements/table/TablePagination.ts index 7994f76fe..eb904234c 100644 --- a/web/src/elements/table/TablePagination.ts +++ b/web/src/elements/table/TablePagination.ts @@ -1,6 +1,6 @@ import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { AKPagination } from "../../api/Client"; -import { gettext } from "django"; +import { t } from "@lingui/macro"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFPagination from "@patternfly/patternfly/components/Pagination/pagination.css"; @@ -37,7 +37,7 @@ export class TablePagination extends LitElement { class="pf-c-button pf-m-plain" @click=${() => { this.pageChangeHandler(this.pages?.previous || 0); }} ?disabled="${(this.pages?.previous || 0) < 1}" - aria-label="${gettext("Go to previous page")}" + aria-label="${t`Go to previous page`}" > @@ -47,7 +47,7 @@ export class TablePagination extends LitElement { class="pf-c-button pf-m-plain" @click=${() => { this.pageChangeHandler(this.pages?.next || 0); }} ?disabled="${(this.pages?.next || 0) <= 0}" - aria-label="${gettext("Go to next page")}" + aria-label="${t`Go to next page`}" > diff --git a/web/src/elements/user/UserConsentList.ts b/web/src/elements/user/UserConsentList.ts index 921bb43ef..4c1174d7d 100644 --- a/web/src/elements/user/UserConsentList.ts +++ b/web/src/elements/user/UserConsentList.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Table, TableColumn } from "../table/Table"; @@ -26,8 +26,8 @@ export class UserConsentList extends Table { columns(): TableColumn[] { return [ - new TableColumn("Application", "application"), - new TableColumn("Expires", "expires"), + new TableColumn(t`Application`, t`application`), + new TableColumn(t`Expires`, t`expires`), new TableColumn(""), ]; } @@ -39,14 +39,14 @@ export class UserConsentList extends Table { html` { return new CoreApi(DEFAULT_CONFIG).coreUserConsentDelete({ id: item.pk || 0, }); }}> `, ]; diff --git a/web/src/flows/FlowExecutor.ts b/web/src/flows/FlowExecutor.ts index ac991d3cd..333375ac3 100644 --- a/web/src/flows/FlowExecutor.ts +++ b/web/src/flows/FlowExecutor.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { LitElement, html, customElement, property, TemplateResult, CSSResult, css } from "lit-element"; import PFLogin from "@patternfly/patternfly/components/Login/login.css"; @@ -152,11 +152,11 @@ export class FlowExecutor extends LitElement implements StageHost { type: ChallengeTypeEnum.Shell, body: ` ` }; @@ -178,7 +178,7 @@ export class FlowExecutor extends LitElement implements StageHost { window.location.assign((this.challenge as RedirectChallenge).to); return html` + header=${t`Loading`}> `; case ChallengeTypeEnum.Shell: return html`${unsafeHTML((this.challenge as ShellChallenge).body)}`; @@ -225,7 +225,7 @@ export class FlowExecutor extends LitElement implements StageHost { if (!this.challenge) { return html` + header=${t`Loading`}> `; } return html` @@ -267,7 +267,7 @@ export class FlowExecutor extends LitElement implements StageHost { `; }))} ${this.config?.brandingTitle != "authentik" ? html` -
  • ${gettext("Powered by authentik")}
  • +
  • ${t`Powered by authentik`}
  • ` : html``} diff --git a/web/src/flows/FormStatic.ts b/web/src/flows/FormStatic.ts index ae52f6434..9826fe953 100644 --- a/web/src/flows/FormStatic.ts +++ b/web/src/flows/FormStatic.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css"; import { ifDefined } from "lit-html/directives/if-defined"; @@ -40,7 +40,7 @@ export class FormStatic extends LitElement { return html`
    - ${gettext( + ${t`User's avatar`} ${this.user}
    diff --git a/web/src/flows/access_denied/FlowAccessDenied.ts b/web/src/flows/access_denied/FlowAccessDenied.ts index bdbd3df16..0005f23f7 100644 --- a/web/src/flows/access_denied/FlowAccessDenied.ts +++ b/web/src/flows/access_denied/FlowAccessDenied.ts @@ -8,7 +8,7 @@ import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFList from "@patternfly/patternfly/components/List/list.css"; import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; import AKGlobal from "../../authentik.css"; -import { gettext } from "django"; +import { t } from "@lingui/macro"; import "../../elements/EmptyState"; @@ -30,7 +30,7 @@ export class FlowAccessDenied extends BaseStage { if (!this.challenge) { return html` + header=${t`Loading`}> `; } return html`
    `}
    diff --git a/web/src/flows/stages/autosubmit/AutosubmitStage.ts b/web/src/flows/stages/autosubmit/AutosubmitStage.ts index 827059fbf..7a9cd14b4 100644 --- a/web/src/flows/stages/autosubmit/AutosubmitStage.ts +++ b/web/src/flows/stages/autosubmit/AutosubmitStage.ts @@ -1,4 +1,4 @@ -import { gettext } from "django"; +import { t } from "@lingui/macro"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; import { WithUserInfoChallenge } from "../../../api/Flows"; import PFLogin from "@patternfly/patternfly/components/Login/login.css"; @@ -34,7 +34,7 @@ export class AutosubmitStage extends BaseStage { if (!this.challenge) { return html` + header=${t`Loading`}> `; } return html`