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

@ -392,7 +392,25 @@ class LocaleController extends Zend_Controller_Action
"Copied %s row%s to the clipboard" => _("Copied %s row%s to the clipboard"),
"%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished." => _("%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished."),
"New Show" => _("New Show"),
"New Log Entry" => _("New Log Entry")
"New Log Entry" => _("New Log Entry"),
//Datatables:
"No data available in table",
"Showing _START_ to _END_ of _TOTAL_ entries",
"Showing 0 to 0 of 0 entries",
"(filtered from _MAX_ total entries)",
"",
",",
"Show _MENU_",
"Loading...",
"Processing...",
"No matching records found",
"First",
"Last",
"Next",
"Previous",
": activate to sort column ascending",
": activate to sort column descending"
//End of datatables
);
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

View File

@ -3135,7 +3135,7 @@ dd .stream-status {
width: 65%;
}
.status-good {
background:#e3ffc9 url(images/stream_status.png) no-repeat 8px 5px;
background:#e3ffc9 url(images/stream_status.png) no-repeat 8px 8px;
border-color:#54b300;
}
.status-good p {

View File

@ -62,6 +62,35 @@ var i18n_days_short = [
$.i18n._("Sa")
];
function getDatatablesStrings(overrideDict) {
var dict = {
"sEmptyTable": $.i18n._("No data available in table"),
"sInfo": $.i18n._("Showing _START_ to _END_ of _TOTAL_ entries"),
"sInfoEmpty": $.i18n._("Showing 0 to 0 of 0 entries"),
"sInfoFiltered": $.i18n._("(filtered from _MAX_ total entries)"),
"sInfoPostFix": $.i18n._(""),
"sInfoThousands": $.i18n._("),"),
"sLengthMenu": $.i18n._("Show _MENU_"),
"sLoadingRecords": $.i18n._("Loading..."),
"sProcessing": $.i18n._("Processing..."),
"sSearch": $.i18n._(""),
"sZeroRecords": $.i18n._("No matching records found"),
"oPaginate": {
"sFirst": $.i18n._("First"),
"sLast": $.i18n._("Last"),
"sNext": $.i18n._("Next"),
"sPrevious": $.i18n._("Previous")
},
"oAria": {
"sSortAscending": $.i18n._(": activate to sort column ascending"),
"sSortDescending": $.i18n._(": activate to sort column descending")
}
};
return $.extend({}, dict, overrideDict);
}
function adjustDateToServerDate(date, serverTimezoneOffset){
//date object stores time in the browser's localtime. We need to artificially shift
//it to

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>',

View File

@ -94,7 +94,7 @@ function checkLiquidsoapStatus(){
}
var html;
if(status == "OK"){
html = '<div class="stream-status status-good"><hp3>'+$.i18n._("Connected to the streaming server")+'</p></div>';
html = '<div class="stream-status status-good"><p>'+$.i18n._("Connected to the streaming server")+'</p></div>';
}else if(status == "N/A"){
html = '<div class="stream-status status-disabled"><p>'+$.i18n._("The stream is disabled")+'</p></div>';
}else if(status == "waiting"){

View File

@ -772,7 +772,10 @@ var AIRTIME = (function(AIRTIME){
},
"sAjaxDataProp": "schedule",
"oLanguage": datatables_dict,
"oLanguage": getDatatablesStrings({
"sZeroRecords": $.i18n._("There are no shows scheduled during the specified time period."),
"sEmptyTable": $.i18n._("There are no shows scheduled during the specified time period."),
}),
"sAjaxSource": baseUrl+"showbuilder/builder-feed",
"bScrollCollapseY": false