MCPcopy Create free account
hub / github.com/bytebase/bytebase / migrateLanguage

Function migrateLanguage

frontend/src/utils/storage-migrate.ts:47–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45}
46
47function migrateLanguage() {
48 // Old format: key "bytebase_options", value {"appearance":{"language":"zh-CN"}}
49 // New format: key "bb.language", value zh-CN (plain string)
50 const old = localStorage.getItem("bytebase_options");
51 if (!old) return;
52
53 if (localStorage.getItem(STORAGE_KEY_LANGUAGE) === null) {
54 try {
55 const parsed = JSON.parse(old) as {
56 appearance?: { language?: string };
57 };
58 const lang = parsed?.appearance?.language;
59 if (lang) {
60 localStorage.setItem(STORAGE_KEY_LANGUAGE, lang);
61 }
62 } catch {
63 // ignore malformed
64 }
65 }
66 localStorage.removeItem("bytebase_options");
67}
68
69function migrateStaticKeys() {
70 for (const [oldKey, newKey] of STATIC_KEY_RENAMES) {

Callers 1

migrateStorageKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected