Skip to content

Commit fbf8f6a

Browse files
committed
index.js: only write search data for English, stop other langs from breaking search data
1 parent d0c95f7 commit fbf8f6a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javascript/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ async function main() {
370370
recursiveTranslateXml("", "parseXml");
371371
} else if (parseType == "json") {
372372
const languages = await getDirectories(path.join(__dirname, "../xml"));
373+
languages.sort(function (x,y) { return x==="en" ? -1 : y==="en" ? 1 : 0; }); // put "en" at front
373374
console.dir(languages);
374375

375376
for (const lang of languages) {
@@ -388,7 +389,11 @@ async function main() {
388389
await recursiveXmlToHtmlInOrder("setupSnippet");
389390
console.log("setup snippets and references done\n");
390391
await recursiveXmlToHtmlInOrder("parseXml");
391-
writeRewritedSearchData();
392+
// only write search data for English XMLs
393+
// todo: support for other langs
394+
if (lang === "en") {
395+
writeRewritedSearchData();
396+
}
392397
// this is meant to be temp; also, will remove the original "generateSearchData" after the updation at the frontend is completed.
393398
//testIndexSearch();
394399
}

0 commit comments

Comments
 (0)