()
| 45 | } |
| 46 | |
| 47 | function 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 | |
| 69 | function migrateStaticKeys() { |
| 70 | for (const [oldKey, newKey] of STATIC_KEY_RENAMES) { |
no outgoing calls
no test coverage detected