Internationalized searchbox tooltip

This commit is contained in:
Veloman Yunkan 2022-01-30 22:22:17 +04:00 committed by Matthieu Gautier
parent 5052d4018c
commit a0d9a824e1
6 changed files with 14 additions and 6 deletions

View File

@ -292,6 +292,7 @@ void ContentResponse::introduce_taskbar(const std::string& lang)
{"LIBRARY_BUTTON_TEXT", t("library-button-text")},
{"HOME_BUTTON_TEXT", t("home-button-text", {{"BOOK_TITLE", m_bookTitle}}) },
{"RANDOM_PAGE_BUTTON_TEXT", t("random-page-button-text") },
{"SEARCHBOX_TOOLTIP", t("searchbox-tooltip", {{"BOOK_TITLE", m_bookTitle}}) },
};
auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data);
m_content = prependToFirstOccurence(

View File

@ -22,4 +22,5 @@
, "library-button-text": "Go to welcome page"
, "home-button-text": "Go to the main page of '{{BOOK_TITLE}}'"
, "random-page-button-text": "Go to a randomly selected page"
, "searchbox-tooltip": "Search '{{BOOK_TITLE}}'"
}

View File

@ -13,4 +13,5 @@
, "library-button-text": "Գրադարանի էջ"
, "home-button-text": "Դեպի '{{BOOK_TITLE}}'֊ի գլխավոր էջը"
, "random-page-button-text": "Բացել պատահական էջ"
, "searchbox-tooltip": "Որոնել '{{BOOK_TITLE}}'֊ում"
}

View File

@ -23,4 +23,5 @@
, "library-button-text": "Tooltip of the button leading to the welcome page"
, "home-button-text": "Tooltip of the button leading to the main page of a book"
, "random-page-button-text": "Tooltip of the button opening a randomly selected page"
, "searchbox-tooltip": "Tooltip displayed for the search box"
}

View File

@ -5,7 +5,7 @@
<form class="kiwixsearch" method="GET" action="{{root}}/search" id="kiwixsearchform">
{{#hascontent}}<input type="hidden" name="content" value="{{content}}" />{{/hascontent}}
<label for="kiwixsearchbox">&#x1f50d;</label>
<input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text" title="Search '{{title}}'" aria-label="Search '{{title}}'">
<input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text" title="{{{SEARCHBOX_TOOLTIP}}}" aria-label="{{{SEARCHBOX_TOOLTIP}}}">
</form>
</div>
<input type="checkbox" id="kiwix_button_show_toggle">

View File

@ -520,11 +520,15 @@ std::string TestContentIn404HtmlResponse::hiddenBookNameInput() const
std::string TestContentIn404HtmlResponse::searchPatternInput() const
{
return R"( <input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text" title="Search ')"
+ bookTitle
+ R"('" aria-label="Search ')"
+ bookTitle
+ R"('">
const std::string searchboxTooltip = isTranslatedVersion()
? "Որոնել '" + bookTitle + "'֊ում"
: "Search '" + bookTitle + "'";
return R"( <input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text" title=")"
+ searchboxTooltip
+ R"(" aria-label=")"
+ searchboxTooltip
+ R"(">
)";
}