From b37470b3dee9885f80fb7dc3bf5cfb1b19674284 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 3 Apr 2021 20:34:16 +0200 Subject: [PATCH] web: activate pseudo-locale using querystring Signed-off-by: Jens Langhammer --- web/src/interfaces/AdminInterface.ts | 2 +- web/src/interfaces/locale.ts | 17 +++++++---------- web/src/locales/en.po | 4 ++++ web/src/locales/pseudo-LOCALE.po | 4 ++++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/web/src/interfaces/AdminInterface.ts b/web/src/interfaces/AdminInterface.ts index 834712761..7427ac9a2 100644 --- a/web/src/interfaces/AdminInterface.ts +++ b/web/src/interfaces/AdminInterface.ts @@ -30,7 +30,7 @@ export const SIDEBAR_ITEMS: SidebarItem[] = [ ).when((): Promise => { return me().then(u => u.user.isSuperuser||false); }), - new SidebarItem(`Events`).children( + new SidebarItem(t`Events`).children( new SidebarItem(t`Logs`, "/events/log").activeWhen( `^/events/log/(?${UUID_REGEX})$` ), diff --git a/web/src/interfaces/locale.ts b/web/src/interfaces/locale.ts index 28ce726e5..a545ae580 100644 --- a/web/src/interfaces/locale.ts +++ b/web/src/interfaces/locale.ts @@ -1,17 +1,14 @@ import { i18n } from "@lingui/core"; import { en } from "make-plural/plurals"; import { messages as localeEN } from "../locales/en"; +import { messages as localeDEBUG } from "../locales/pseudo-LOCALE"; -i18n.loadLocaleData("en", { - plurals: en -}); +i18n.loadLocaleData("en", { plurals: en }); +i18n.loadLocaleData("debug", { plurals: en }); i18n.load("en", localeEN); +i18n.load("debug", localeDEBUG); i18n.activate("en"); -// Uncomment to debug localisation -// import { messages as localeDEBUG } from "../locales/pseudo-LOCALE"; -// i18n.load("debug", localeDEBUG); -// i18n.activate("debug"); -// i18n.loadLocaleData("debug", { -// plurals: en -// }); +if (window.location.search.includes("debugLocale")) { + i18n.activate("debug"); +} diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 526d791a6..fd524ce5b 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -1071,6 +1071,10 @@ msgstr "Evaluate policies when the Stage is present to the user." msgid "Event {0}" msgstr "Event {0}" +#: src/interfaces/AdminInterface.ts:23 +msgid "Events" +msgstr "Events" + #: src/pages/events/EventInfo.ts:129 #: src/pages/events/EventInfo.ts:152 msgid "Exception" diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index d248f7d3b..0bd899154 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -1067,6 +1067,10 @@ msgstr "" msgid "Event {0}" msgstr "" +#: src/interfaces/AdminInterface.ts:23 +msgid "Events" +msgstr "" + #: src/pages/events/EventInfo.ts:129 #: src/pages/events/EventInfo.ts:152 msgid "Exception"