fix: UI not defaulting to browser's language

fixes #123

i apparently broke this lol, oops
This commit is contained in:
Maya 2025-10-15 19:57:14 +03:00
parent cbff253b5f
commit c0410ae9bb
No known key found for this signature in database
4 changed files with 6 additions and 3 deletions

View File

@ -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"

View File

@ -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",

View File

@ -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

View File

@ -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();