v3: added localization, use global player for uploaded audio/video files

This commit is contained in:
khannurien
2026-04-03 15:29:33 +00:00
parent 378b3ffa46
commit 0ce80398a4
64 changed files with 4248 additions and 941 deletions

20
src/i18n.ts Normal file
View File

@@ -0,0 +1,20 @@
import { i18n } from "@lingui/core";
const SUPPORTED = ["en", "fr"] as const;
type Locale = (typeof SUPPORTED)[number];
function detectLocale(): Locale {
const stored = localStorage.getItem("locale");
if (stored && (SUPPORTED as readonly string[]).includes(stored)) return stored as Locale;
return navigator.language.startsWith("fr") ? "fr" : "en";
}
export async function loadCatalog(locale: Locale = detectLocale()) {
const { messages } = await import(`./locales/${locale}.po`);
i18n.load(locale, messages);
i18n.activate(locale);
localStorage.setItem("locale", locale);
}
export { i18n };
export type { Locale };