From ccc2a5bdfeb36ea7ebe1ffae57c58824b096d04f Mon Sep 17 00:00:00 2001 From: Teffen Ellis Date: Thu, 26 Jun 2025 22:20:39 +0200 Subject: [PATCH] web: Clean up locale. --- .../elements/ak-locale-context/definitions.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/web/src/elements/ak-locale-context/definitions.ts b/web/src/elements/ak-locale-context/definitions.ts index 8d22a024bc..ef21a93ebc 100644 --- a/web/src/elements/ak-locale-context/definitions.ts +++ b/web/src/elements/ak-locale-context/definitions.ts @@ -1,4 +1,4 @@ -import * as _enLocale from "@goauthentik/locales/en"; +import * as _enLocale from "#locales/en"; import type { LocaleModule } from "@lit/localize"; import { msg } from "@lit/localize"; @@ -12,7 +12,7 @@ const enLocale: LocaleModule = _enLocale; export { enLocale }; // NOTE: This table cannot be made any shorter, despite all the repetition of syntax. Bundlers look -// for the `await import` string as a *string target* for doing alias substitution, so putting +// for the `import` #a *string target* for doing alias substitution, so putting // the import in some sort of abstracting function doesn't work. The same is true for the `msg()` // function, which `localize` uses to find strings for extraction and translation. Likewise, // because this is a file-level table, the `msg()` must be thunked so that they're re-run when @@ -37,24 +37,24 @@ export { enLocale }; // prettier-ignore const debug: LocaleRow = [ - "pseudo-LOCALE", /^pseudo/i, () => msg("Pseudolocale (for testing)"), async () => await import("@goauthentik/locales/pseudo-LOCALE"), + "pseudo-LOCALE", /^pseudo/i, () => msg("Pseudolocale (for testing)"), () => import("#locales/pseudo-LOCALE"), ]; // prettier-ignore const LOCALE_TABLE: LocaleRow[] = [ - ["de", /^de([_-]|$)/i, () => msg("German"), async () => await import("@goauthentik/locales/de")], - ["en", /^en([_-]|$)/i, () => msg("English"), async () => await import("@goauthentik/locales/en")], - ["es", /^es([_-]|$)/i, () => msg("Spanish"), async () => await import("@goauthentik/locales/es")], - ["fr", /^fr([_-]|$)/i, () => msg("French"), async () => await import("@goauthentik/locales/fr")], - ["it", /^it([_-]|$)/i, () => msg("Italian"), async () => await import("@goauthentik/locales/it")], - ["ko", /^ko([_-]|$)/i, () => msg("Korean"), async () => await import("@goauthentik/locales/ko")], - ["nl", /^nl([_-]|$)/i, () => msg("Dutch"), async () => await import("@goauthentik/locales/nl")], - ["pl", /^pl([_-]|$)/i, () => msg("Polish"), async () => await import("@goauthentik/locales/pl")], - ["ru", /^ru([_-]|$)/i, () => msg("Russian"), async () => await import("@goauthentik/locales/ru")], - ["tr", /^tr([_-]|$)/i, () => msg("Turkish"), async () => await import("@goauthentik/locales/tr")], - ["zh_TW", /^zh[_-]TW$/i, () => msg("Taiwanese Mandarin"), async () => await import("@goauthentik/locales/zh_TW")], - ["zh-Hans", /^zh(\b|_)/i, () => msg("Chinese (simplified)"), async () => await import("@goauthentik/locales/zh-Hans")], - ["zh-Hant", /^zh[_-](HK|Hant)/i, () => msg("Chinese (traditional)"), async () => await import("@goauthentik/locales/zh-Hant")], + ["de", /^de([_-]|$)/i, () => msg("German"), () => import("#locales/de")], + ["en", /^en([_-]|$)/i, () => msg("English"), () => import("#locales/en")], + ["es", /^es([_-]|$)/i, () => msg("Spanish"), () => import("#locales/es")], + ["fr", /^fr([_-]|$)/i, () => msg("French"), () => import("#locales/fr")], + ["it", /^it([_-]|$)/i, () => msg("Italian"), () => import("#locales/it")], + ["ko", /^ko([_-]|$)/i, () => msg("Korean"), () => import("#locales/ko")], + ["nl", /^nl([_-]|$)/i, () => msg("Dutch"), () => import("#locales/nl")], + ["pl", /^pl([_-]|$)/i, () => msg("Polish"), () => import("#locales/pl")], + ["ru", /^ru([_-]|$)/i, () => msg("Russian"), () => import("#locales/ru")], + ["tr", /^tr([_-]|$)/i, () => msg("Turkish"), () => import("#locales/tr")], + ["zh_TW", /^zh[_-]TW$/i, () => msg("Taiwanese Mandarin"), () => import("#locales/zh_TW")], + ["zh-Hans", /^zh(\b|_)/i, () => msg("Chinese (simplified)"), () => import("#locales/zh-Hans")], + ["zh-Hant", /^zh[_-](HK|Hant)/i, () => msg("Chinese (traditional)"), () => import("#locales/zh-Hant")], debug ];