web: initial migration to lingui
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -13,7 +13,7 @@ import "../elements/notifications/NotificationDrawer";
|
||||
import "../elements/Banner";
|
||||
import { until } from "lit-html/directives/until";
|
||||
import { me } from "../api/Users";
|
||||
import { gettext } from "django";
|
||||
import { t } from "@lingui/macro";
|
||||
import { EVENT_NOTIFICATION_TOGGLE, EVENT_SIDEBAR_TOGGLE } from "../constants";
|
||||
|
||||
export abstract class Interface extends LitElement {
|
||||
@ -52,9 +52,9 @@ export abstract class Interface extends LitElement {
|
||||
${until(me().then((u) => {
|
||||
if (u.original) {
|
||||
return html`<ak-banner>
|
||||
${gettext(`You're currently impersonating ${u.user.username}.`)}
|
||||
${t`You're currently impersonating ${u.user.username}.`}
|
||||
<a href=${`/-/impersonation/end/?back=${window.location.pathname}%23${window.location.hash}`}>
|
||||
${gettext("Stop impersonation")}
|
||||
${t`Stop impersonation`}
|
||||
</a>
|
||||
</ak-banner>`;
|
||||
}
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
import { i18n } from '@lingui/core'
|
||||
import { i18n } from "@lingui/core";
|
||||
import { en } from "make-plural/plurals";
|
||||
import { messages as localeEN } from "../locales/en";
|
||||
|
||||
// messages.js is generated by the cli
|
||||
import { messages } from '../locales/en';
|
||||
|
||||
i18n.load('en', messages)
|
||||
i18n.activate('en')
|
||||
i18n.loadLocaleData("en", {
|
||||
plurals: en
|
||||
});
|
||||
i18n.load("en", localeEN);
|
||||
i18n.activate("en");
|
||||
// Uncomment to debug localisation
|
||||
// import { messages as localeDEBUG } from "../locales/pseudo-LOCALE";
|
||||
// i18n.load("debug", localeDEBUG);
|
||||
// i18n.activate("debug");
|
||||
|
||||
Reference in New Issue
Block a user