mirror of https://github.com/VERT-sh/VERT.git
fix: UI not defaulting to browser's language
fixes #123 i apparently broke this lol, oops
This commit is contained in:
parent
cbff253b5f
commit
c0410ae9bb
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://inlang.com/schema/project-settings",
|
"$schema": "https://inlang.com/schema/project-settings",
|
||||||
"baseLocale": "en",
|
"baseLocale": "en",
|
||||||
"locales": ["en", "es", "fr", "de", "it", "hr", "el", "tr", "ja"],
|
"locales": ["en", "es", "fr", "de", "it", "hr", "tr", "ja", "el"],
|
||||||
"modules": [
|
"modules": [
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js",
|
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js",
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"
|
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js"
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class FFmpegConverter extends Converter {
|
||||||
this.status = "ready";
|
this.status = "ready";
|
||||||
})();
|
})();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(["converters", this.name], `error loading ffmpeg: ${err}`);
|
error(["converters", this.name], `Error loading ffmpeg: ${err}`);
|
||||||
this.status = "error";
|
this.status = "error";
|
||||||
ToastManager.add({
|
ToastManager.add({
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|
|
@ -330,6 +330,8 @@ export const availableLocales = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function updateLocale(newLocale: string) {
|
export function updateLocale(newLocale: string) {
|
||||||
|
if (!Object.keys(availableLocales).includes(newLocale)) newLocale = "en";
|
||||||
|
|
||||||
log(["locale"], `set to ${newLocale}`);
|
log(["locale"], `set to ${newLocale}`);
|
||||||
localStorage.setItem("locale", newLocale);
|
localStorage.setItem("locale", newLocale);
|
||||||
// @ts-expect-error shush
|
// @ts-expect-error shush
|
||||||
|
|
|
@ -89,7 +89,8 @@
|
||||||
theme.set(
|
theme.set(
|
||||||
(localStorage.getItem("theme") as "light" | "dark") || "light",
|
(localStorage.getItem("theme") as "light" | "dark") || "light",
|
||||||
);
|
);
|
||||||
updateLocale(localStorage.getItem("locale") || "en");
|
const storedLocale = localStorage.getItem("locale");
|
||||||
|
if (storedLocale) updateLocale(storedLocale);
|
||||||
|
|
||||||
Settings.instance.load();
|
Settings.instance.load();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue