Moved datatables translation stuff to PHP for consistency

This commit is contained in:
Albert Santoni 2015-08-14 20:00:05 -04:00
parent 7ce9dfa1b3
commit 8aa39ae28d
8 changed files with 94 additions and 7 deletions

View file

@ -531,6 +531,41 @@ var AIRTIME = (function(AIRTIME) {
}
}
function getLibraryDatatableStrings() {
//Set up the datatables string translation table with different strings depending on
//whether you're viewing files, playlists, smart blocks, etc.
var type = parseInt($(".media_type_selector.selected").attr("selection_id"));
type = (type === undefined) ? 1 : type;
//FIXME: The code that calls this function doesn't work as intended because you can't
// change the oLanguage property of a datatable dynamically. :(
switch (type) {
case 0:
return getDatatablesStrings({
"sEmptyTable": $.i18n._("No files found"),
});
break;
case 1:
return getDatatablesStrings({
"sEmptyTable": $.i18n._("No playlists found"),
});
break;
case 2:
return getDatatablesStrings({
"sEmptyTable": $.i18n._("No smart blocks found"),
});
break;
default:
return getDatatablesStrings({
"sEmptyTable": $.i18n._(""),
"sZeroRecords": $.i18n._("")
});
break;
};
}
oTable = $libTable.dataTable( {
// put hidden columns at the top to insure they can never be visible
@ -726,7 +761,7 @@ var AIRTIME = (function(AIRTIME) {
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": false,
"oLanguage": datatables_dict,
"oLanguage": getLibraryDatatableStrings(),
// R = ColReorder, C = ColVis
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ilp>>',

View file

@ -207,7 +207,7 @@ var AIRTIME = (function(AIRTIME) {
var data = el.prev().data("aData");
if (data === undefined) {
alert($.i18n._("Cannot schedule outside a show."));
alert($.i18n._("Cannot schedule outside a show.\nTry creating a show first."));
return false;
}

View file

@ -770,7 +770,9 @@ var AIRTIME = (function(AIRTIME) {
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": false,
"oLanguage": datatables_dict,
"oLanguage": getDatatablesStrings({
"sZeroRecords": $.i18n._("No matching records found."),
}),
// R = ColReorder, C = ColVis
"sDom": 'Rl<"#library_display_type">f<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>',