Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(spec-review): validate each stored language key before falling back

hugohe331fb1b61dd73
diff --git a/skills/ppt-master/scripts/spec_review/static/app.js b/skills/ppt-master/scripts/spec_review/static/app.js
index 8ef03b11..892e74b4 100644
--- a/skills/ppt-master/scripts/spec_review/static/app.js
+++ b/skills/ppt-master/scripts/spec_review/static/app.js
@@ -85,10 +85,12 @@ const node = (tag, text) => {
const detected = navigator.language.toLowerCase();
let lang = detected.startsWith('zh') ? (/\b(tw|hk|mo|hant)\b/.test(detected) && !/\bhans\b/.test(detected) ? 'zh-TW' : 'zh') :
(detected.startsWith('ja') ? 'ja' : 'en');
-// `ppt_lang` is shared with the other local UIs; the old key is a read-only fallback.
+// `ppt_lang` is the key the other local UIs use; the old key is a read-only fallback.
+// Each key is validated on its own so an invalid new value cannot hide a valid old one.
try {
- const stored = localStorage.getItem('ppt_lang') || localStorage.getItem('spec-review-language');
- if (Object.hasOwn(strings, stored)) lang = stored;
+ const stored = ['ppt_lang', 'spec-review-language'].map(key => localStorage.getItem(key))
+ .find(value => Object.hasOwn(strings, value));
+ if (stored) lang = stored;
} catch (_) { /* Optional browser storage. */ }
const t = key => strings[lang][key];