web: the return of pseudolocalization (#7190)

* web: the return of pseudolocalization

The move to lit-locale lost the ability to automagically pseudolocalize the UI, a useful
utility for checking that additions to the UI have been properly cataloged as
translation targets.  This short script (barely 40 lines) digs deep into the lit-localize
toolkit and produces a pretranslated translation bundle in the target format folder.

* Linted, prettied, and commented.
This commit is contained in:
Ken Sternberg
2023-10-16 13:54:43 -07:00
committed by GitHub
parent 0697e3d5a4
commit 9e568e1e85
6 changed files with 1674 additions and 4 deletions

View File

@ -35,6 +35,11 @@ export { enLocale };
// - Text Label
// - Locale loader.
// prettier-ignore
const debug: LocaleRow = [
"pseudo-LOCALE", /^pseudo/i, () => msg("Pseudolocale (for testing)"), async () => await import("@goauthentik/locales/pseudo-LOCALE"),
];
// prettier-ignore
const LOCALE_TABLE: LocaleRow[] = [
["en", /^en([_-]|$)/i, () => msg("English"), async () => await import("@goauthentik/locales/en")],
@ -46,6 +51,7 @@ const LOCALE_TABLE: LocaleRow[] = [
["zh-Hant", /^zh[_-](HK|Hant)/i, () => msg("Chinese (traditional)"), async () => await import("@goauthentik/locales/zh-Hant")],
["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")],
debug
];
export const LOCALES: AkLocale[] = LOCALE_TABLE.map(([code, match, label, locale]) => ({