Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: get locale in `useLocalStorage` (#1848)

boojack144fc0feb24e
diff --git a/frontend/src/plugins/demo/hint.ts b/frontend/src/plugins/demo/hint.ts
index 82c20b198a..1259856c63 100644
--- a/frontend/src/plugins/demo/hint.ts
+++ b/frontend/src/plugins/demo/hint.ts
@@ -180,6 +180,10 @@ const adjustHintDialogPosition = (
bounding.left + bounding.width - hintDialogBounding.width
}px`;
}
+
+ requestAnimationFrame(() =>
+ adjustHintDialogPosition(targetElement, hintDialogDiv, position)
+ );
};
const updateHintPosition = (
diff --git a/frontend/src/plugins/i18n.ts b/frontend/src/plugins/i18n.ts
index b324121587..d98de5c55c 100644
--- a/frontend/src/plugins/i18n.ts
+++ b/frontend/src/plugins/i18n.ts
@@ -3,18 +3,18 @@ import { createI18n } from "vue-i18n";
import { useLocalStorage } from "@vueuse/core";
const localPathPrefix = "../locales/";
+const validLocaleList = ["en-US", "zh-CN"];
const getValidLocale = () => {
- const validLocales = ["en-US", "zh-CN"];
const params = new URL(window.location.href).searchParams;
let locale = params.get("locale") || "";
- if (validLocales.includes(locale)) {
+ if (validLocaleList.includes(locale)) {
return locale;
}
const storage = useLocalStorage("bytebase_options", {}) as any;
- locale = storage.appearance?.language || "";
- if (validLocales.includes(locale)) {
+ locale = storage.value?.appearance?.language || "";
+ if (validLocaleList.includes(locale)) {
return locale;
}
@@ -24,7 +24,7 @@ const getValidLocale = () => {
// here if we got "en" from localStorage
locale = "en-US";
}
- if (validLocales.includes(locale)) {
+ if (validLocaleList.includes(locale)) {
return locale;
}
diff --git a/scripts/demo.sh b/scripts/demo.sh
index 69212a78fb..dfb5fde89c 100644
--- a/scripts/demo.sh
+++ b/scripts/demo.sh
@@ -52,7 +52,7 @@ seedDemoData() {
startReadonly() {
echo "Starting Bytebase in readonly and demo mode at ${ONLINE_DEMO_HOST}:${ONLINE_DEMO_PORT}..."
- bytebase --host ${ONLINE_DEMO_HOST} --port ${ONLINE_DEMO_PORT} --readonly --demo --data /var/opt/bytebase
+ bytebase --host ${ONLINE_DEMO_HOST} --port ${ONLINE_DEMO_PORT} --readonly --demo -demo-name ${DEMO_NAME} --data /var/opt/bytebase
}
seedDemoData