Internationalized "Go to the main page" button

This commit is contained in:
Veloman Yunkan 2022-01-30 21:41:56 +04:00 committed by Matthieu Gautier
parent ed7717c1e7
commit 3da81a3d0f
6 changed files with 10 additions and 1 deletions

View File

@ -60,6 +60,11 @@ public:
return getTranslatedString(m_lang, key); return getTranslatedString(m_lang, key);
} }
std::string operator()(const std::string& key, const Parameters& params) const
{
return expandParameterizedString(m_lang, key, params);
}
private: private:
const std::string m_lang; const std::string m_lang;
}; };

View File

@ -290,6 +290,7 @@ void ContentResponse::introduce_taskbar(const std::string& lang)
{"title", m_bookTitle}, {"title", m_bookTitle},
{"withlibrarybutton", m_withLibraryButton}, {"withlibrarybutton", m_withLibraryButton},
{"LIBRARY_BUTTON_TEXT", t("library-button-text")}, {"LIBRARY_BUTTON_TEXT", t("library-button-text")},
{"HOME_BUTTON_TEXT", t("home-button-text", {{"BOOK_TITLE", m_bookTitle}}) },
}; };
auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data); auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data);
m_content = prependToFirstOccurence( m_content = prependToFirstOccurence(

View File

@ -20,4 +20,5 @@
, "fulltext-search-unavailable" : "Fulltext search unavailable" , "fulltext-search-unavailable" : "Fulltext search unavailable"
, "no-search-results": "The fulltext search engine is not available for this content." , "no-search-results": "The fulltext search engine is not available for this content."
, "library-button-text": "Go to welcome page" , "library-button-text": "Go to welcome page"
, "home-button-text": "Go to the main page of '{{BOOK_TITLE}}'"
} }

View File

@ -10,4 +10,5 @@
, "404-page-title" : "Սխալ հասցե" , "404-page-title" : "Սխալ հասցե"
, "404-page-heading" : "Սխալ հասցե" , "404-page-heading" : "Սխալ հասցե"
, "library-button-text": "Գրադարանի էջ" , "library-button-text": "Գրադարանի էջ"
, "home-button-text": "Դեպի '{{BOOK_TITLE}}'֊ի գլխավոր էջը"
} }

View File

@ -21,4 +21,5 @@
, "fulltext-search-unavailable" : "Title of the error page returned when search is attempted in a book without fulltext search database" , "fulltext-search-unavailable" : "Title of the error page returned when search is attempted in a book without fulltext search database"
, "no-search-results": "Text of the error page returned when search is attempted in a book without fulltext search database" , "no-search-results": "Text of the error page returned when search is attempted in a book without fulltext search database"
, "library-button-text": "Tooltip of the button leading to the welcome page" , "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"
} }

View File

@ -15,7 +15,7 @@
<a id="kiwix_serve_taskbar_library_button" title="{{{LIBRARY_BUTTON_TEXT}}}" aria-label="{{{LIBRARY_BUTTON_TEXT}}}" href="{{root}}/"><button>&#x1f3e0;</button></a> <a id="kiwix_serve_taskbar_library_button" title="{{{LIBRARY_BUTTON_TEXT}}}" aria-label="{{{LIBRARY_BUTTON_TEXT}}}" href="{{root}}/"><button>&#x1f3e0;</button></a>
{{/withlibrarybutton}} {{/withlibrarybutton}}
{{#hascontent}} {{#hascontent}}
<a id="kiwix_serve_taskbar_home_button" title="Go to the main page of '{{title}}'" aria-label="Go to the main page of '{{title}}'" href="{{root}}/{{content}}/"><button>{{title}}</button></a> <a id="kiwix_serve_taskbar_home_button" title="{{{HOME_BUTTON_TEXT}}}" aria-label="{{{HOME_BUTTON_TEXT}}}" href="{{root}}/{{content}}/"><button>{{title}}</button></a>
<a id="kiwix_serve_taskbar_random_button" title="Go to a randomly selected page" aria-label="Go to a randomly selected page" <a id="kiwix_serve_taskbar_random_button" title="Go to a randomly selected page" aria-label="Go to a randomly selected page"
href="{{root}}/random?content={{#urlencoded}}{{{content}}}{{/urlencoded}}"><button>&#x1F3B2;</button></a> href="{{root}}/random?content={{#urlencoded}}{{{content}}}{{/urlencoded}}"><button>&#x1F3B2;</button></a>
{{/hascontent}} {{/hascontent}}