Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions core_js/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ function getLog()
log.log.sort(function(a,b) {
return b.timestamp - a.timestamp;
});

$('#logTable').DataTable({

let lang = getUILanguageCode();
let dataTableOptions = {
"data": log.log,
"columns": [
{
Expand All @@ -78,21 +79,30 @@ function getLog()
render: toDate
}
],
"pageLength": 10,
"language": {
"url": getDataTableTranslation()
}
} ).order([3, 'desc']).draw();
"pageLength": 10
};
if (lang !== "en") {
dataTableOptions.language = {
"url": getDataTableTranslation(lang)
};
}

$('#logTable').DataTable(dataTableOptions).order([3, 'desc']).draw();
}).catch(handleError);
}

/**
* Get the translation file for the DataTable
* Get the two-letter language code of the browser's UI language
*/
function getDataTableTranslation()
{
function getUILanguageCode() {
let lang = browser.i18n.getUILanguage();
lang = lang.substring(0,2);
return lang.substring(0, 2).toLowerCase();
}

/**
* Get the translation file for the DataTable
*/
function getDataTableTranslation(lang) {
return browser.runtime.getURL('./external_js/dataTables/i18n/' + lang + '.json');
}

Expand Down