Translation

This commit is contained in:
Kevin Röbert
2018-05-21 23:25:20 +02:00
parent ff88d9c0ae
commit c42eae5e4a
7 changed files with 448 additions and 81 deletions

View File

@@ -59,6 +59,31 @@ function toDate(time)
* Load only when document is ready
*/
$(document).ready(function(){
setText();
getLog();
$('#reset_log_btn').on("click", resetGlobalLog);
});
/**
* Translate a string with the i18n API.
*
* @param {string} string Name of the attribute used for localization
*/
function translate(string)
{
return browser.i18n.getMessage(string);
}
/**
* Set the text for the UI.
*/
function setText()
{
document.title = translate('log_html_page_title');
$('#page_title').text(translate('log_html_page_title'));
$('#reset_log_btn').text(translate('log_html_reset_button'));
$('#head_1').text(translate('log_html_table_head_1'));
$('#head_2').text(translate('log_html_table_head_2'));
$('#head_3').text(translate('log_html_table_head_3'));
$('#head_4').text(translate('log_html_table_head_4'));
}