Fix typecheck mismatch by mapping rqlite to sqlite and add Italian locale (#787)
Thanks for adding Italian locale support and fixing the rqlite dialect mapping, @fraluc06!
This commit is contained in:
parent
9858fc40d2
commit
28e8a77fa3
|
|
@ -2,19 +2,20 @@ import { createI18n } from "vue-i18n";
|
|||
import zhCN from "./locales/zh-CN";
|
||||
import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/safeStorage";
|
||||
|
||||
export type Locale = "en" | "es" | "zh-CN" | "zh-TW";
|
||||
export type Locale = "en" | "es" | "it" | "zh-CN" | "zh-TW";
|
||||
type LocaleMessages = Record<string, unknown>;
|
||||
type I18nGlobal = {
|
||||
locale: { value: Locale };
|
||||
setLocaleMessage: (locale: Locale, messages: LocaleMessages) => void;
|
||||
};
|
||||
|
||||
const supportedLocales: Locale[] = ["en", "es", "zh-CN", "zh-TW"];
|
||||
const supportedLocales: Locale[] = ["en", "es", "it", "zh-CN", "zh-TW"];
|
||||
const defaultLocale: Locale = "zh-CN";
|
||||
const loadedLocales = new Set<Locale>([defaultLocale]);
|
||||
const localeLoaders: Record<Exclude<Locale, "zh-CN">, () => Promise<{ default: LocaleMessages }>> = {
|
||||
en: () => import("./locales/en"),
|
||||
es: () => import("./locales/es"),
|
||||
it: () => import("./locales/it"),
|
||||
"zh-TW": () => import("./locales/zh-TW"),
|
||||
};
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ export function localeFromLanguageTag(value: string | null | undefined): Locale
|
|||
}
|
||||
if (normalized === "en" || normalized.startsWith("en-")) return "en";
|
||||
if (normalized === "es" || normalized.startsWith("es-")) return "es";
|
||||
if (normalized === "it" || normalized.startsWith("it-")) return "it";
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,6 +3,7 @@ import type { Locale } from "@/i18n";
|
|||
export const LOCALE_OPTIONS: { value: Locale; flag: string; label: string }[] = [
|
||||
{ value: "en", flag: "🇺🇸", label: "English" },
|
||||
{ value: "es", flag: "🇪🇸", label: "Español" },
|
||||
{ value: "it", flag: "🇮🇹", label: "Italiano" },
|
||||
{ value: "zh-CN", flag: "🇨🇳", label: "简体中文" },
|
||||
{ value: "zh-TW", flag: "繁", label: "繁體中文" },
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue