From 2d0788c3981328f1fbd9de4274d2925bf9586e03 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 22:39:16 -0700 Subject: Add multi-lingual Support --- static/search.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'static/search.js') diff --git a/static/search.js b/static/search.js index e6adedf..6aa7019 100644 --- a/static/search.js +++ b/static/search.js @@ -165,7 +165,7 @@ Source: - https://github.com/aaranxu/adidoks/blob/main/static/js/search.js */ (function(){ - //var index = elasticlunr.Index.load(window.searchIndex); + var lang = document.documentElement.getAttribute("lang"); var index; searchinput.addEventListener('input', show_results, true); suggestions.addEventListener('click', accept_suggestion, true); @@ -173,7 +173,7 @@ Source: async function show_results(){ var initIndex = async function () { if (index === undefined) { - index = fetch("/search_index.en.json") + index = fetch("/search_index." + lang + ".json") .then( async function(response) { return await elasticlunr.Index.load(await response.json()); -- cgit v1.3.1