mirror of https://github.com/kiwix/libkiwix.git
Internationalized "Go to a randomly selected page"
At this point a potential issue has been revealed. Now we produce the final HTML via 2-level template expansion 1. Render parameterized messages 2. Render the HTML template In which templates we should use double mustache "{{}}" (HTML-escaping) tags and where we may use triple mustache "{{{}}}" (non-escaping) tags?
This commit is contained in:
parent
527a606281
commit
11be821c46
|
@ -291,6 +291,7 @@ void ContentResponse::introduce_taskbar(const std::string& lang)
|
||||||
{"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}}) },
|
{"HOME_BUTTON_TEXT", t("home-button-text", {{"BOOK_TITLE", m_bookTitle}}) },
|
||||||
|
{"RANDOM_PAGE_BUTTON_TEXT", t("random-page-button-text") },
|
||||||
};
|
};
|
||||||
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(
|
||||||
|
|
|
@ -21,4 +21,5 @@
|
||||||
, "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}}'"
|
, "home-button-text": "Go to the main page of '{{BOOK_TITLE}}'"
|
||||||
|
, "random-page-button-text": "Go to a randomly selected page"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,5 @@
|
||||||
, "404-page-heading" : "Սխալ հասցե"
|
, "404-page-heading" : "Սխալ հասցե"
|
||||||
, "library-button-text": "Գրադարանի էջ"
|
, "library-button-text": "Գրադարանի էջ"
|
||||||
, "home-button-text": "Դեպի '{{BOOK_TITLE}}'֊ի գլխավոր էջը"
|
, "home-button-text": "Դեպի '{{BOOK_TITLE}}'֊ի գլխավոր էջը"
|
||||||
|
, "random-page-button-text": "Բացել պատահական էջ"
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,5 @@
|
||||||
, "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"
|
, "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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
{{/withlibrarybutton}}
|
{{/withlibrarybutton}}
|
||||||
{{#hascontent}}
|
{{#hascontent}}
|
||||||
<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_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="{{{RANDOM_PAGE_BUTTON_TEXT}}}" aria-label="{{{RANDOM_PAGE_BUTTON_TEXT}}}"
|
||||||
href="{{root}}/random?content={{#urlencoded}}{{{content}}}{{/urlencoded}}"><button>🎲</button></a>
|
href="{{root}}/random?content={{#urlencoded}}{{{content}}}{{/urlencoded}}"><button>🎲</button></a>
|
||||||
{{/hascontent}}
|
{{/hascontent}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue