Merge pull request #61 from ViossaDiskordServer/spanish-lang-switching

Adding Spanish locale file references to language switching logic file
This commit is contained in:
Jezza Hehn 2026-05-03 23:58:31 -04:00 committed by GitHub
commit 86836dbe4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,13 +9,14 @@ import { useLocalStorage } from "@vueuse/core";
import { computed, type DeepReadonly } from "vue"; import { computed, type DeepReadonly } from "vue";
import { type } from "arktype"; import { type } from "arktype";
import enUsFtlSrc from "@/assets/locale/en_US.ftl"; import enUsFtlSrc from "@/assets/locale/en_US.ftl";
import esLaFtlSrc from "@/assets/locale/es_LA.ftl";
import vpVlFtlSrc from "@/assets/locale/vp_VL.ftl"; import vpVlFtlSrc from "@/assets/locale/vp_VL.ftl";
import wpVlFtlSrc from "@/assets/locale/wp_VL.ftl"; import wpVlFtlSrc from "@/assets/locale/wp_VL.ftl";
import type { FluentBundle } from "@fluent/bundle"; import type { FluentBundle } from "@fluent/bundle";
import { compileLocale } from "@/vi18n-lib/compile"; import { compileLocale } from "@/vi18n-lib/compile";
import type { ComputedRef } from "vue"; import type { ComputedRef } from "vue";
export const LOCALE_IDS = ["en-US", "vp-VL", "wp-VL"] as const; export const LOCALE_IDS = ["en-US", "es-LA", "vp-VL", "wp-VL"] as const;
export type LocaleId = typeof LocaleId.infer; export type LocaleId = typeof LocaleId.infer;
export const LocaleId = type.enumerated(...LOCALE_IDS); export const LocaleId = type.enumerated(...LOCALE_IDS);
@ -168,13 +169,15 @@ async function initI18n(): Promise<I18n> {
), ),
); );
const [vpVl, wpVl] = await Promise.all([ const [esLa, vpVl, wpVl] = await Promise.all([
doItAllForLocale("es-LA", esLaFtlSrc),
doItAllForLocale("vp-VL", vpVlFtlSrc), doItAllForLocale("vp-VL", vpVlFtlSrc),
doItAllForLocale("wp-VL", wpVlFtlSrc), doItAllForLocale("wp-VL", wpVlFtlSrc),
]); ]);
const localeIdToLocale = { const localeIdToLocale = {
"en-US": deepReadonly(defaultLocale), "en-US": deepReadonly(defaultLocale),
"es-LA": esLa,
"vp-VL": vpVl, "vp-VL": vpVl,
"wp-VL": wpVl, "wp-VL": wpVl,
} as const satisfies Record<LocaleId, DeepReadonly<Locale>>; } as const satisfies Record<LocaleId, DeepReadonly<Locale>>;