Skip to content

Commit

Permalink
Inject TOC title translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaopengLin committed Sep 16, 2024
1 parent 23a2065 commit 8b19fad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/js/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function setupTOC()

var tocTitle = document.createElement('p');
tocTitle.id = "kiwix-toc-title";
tocTitle.textContent = "Contents";
tocTitle.textContent = KIWIX_GT_CONTENT;
toc.prepend(tocTitle);

var tocDiv = document.createElement('div');
Expand Down
6 changes: 5 additions & 1 deletion src/webpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ WebPage::WebPage(QObject *parent) :
action(QWebEnginePage::ViewSource)->setVisible(false);
action(QWebEnginePage::Reload)->setVisible(false);

scripts().insert(getScript(":/js/toc.js"));
auto tocScript = getScript(":/js/toc.js");
auto source = tocScript.sourceCode().prepend("const KIWIX_GT_CONTENT = \"" + gt("table-of-content") + "\";");
tocScript.setSourceCode(source);
qInfo() << source;
scripts().insert(tocScript);
scripts().insert(getScript(":/js/tocStyle.js"));
}

Expand Down

0 comments on commit 8b19fad

Please sign in to comment.