CC-1960: Internationalize Airtime / Support translations

-added i18n jquery library
-created a Locale controller that returns a js dictionary of translations needed in js
-added jquery i18n wrapper function to all strings in js
This commit is contained in:
denise 2012-11-20 11:16:10 -05:00
parent b801235c99
commit 57fdab0ddf
25 changed files with 472 additions and 209 deletions

View file

@ -283,7 +283,7 @@ var AIRTIME = (function(AIRTIME){
mod.fnRemove = function(aItems) {
mod.disableUI();
if (confirm("Delete selected item(s)?")) {
if (confirm($.i18n._("Delete selected item(s)?"))) {
$.post( baseUrl+"/showbuilder/schedule-remove",
{"items": aItems, "format": "json"},
mod.fnItemCallback
@ -360,17 +360,17 @@ var AIRTIME = (function(AIRTIME){
"aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
/* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image sb-image", "sWidth": "16px"},
/* starts */ {"mDataProp": "starts", "sTitle": "Start", "sClass": "sb-starts", "sWidth": "60px"},
/* ends */ {"mDataProp": "ends", "sTitle": "End", "sClass": "sb-ends", "sWidth": "60px"},
/* runtime */ {"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length sb-length", "sWidth": "65px"},
/* title */ {"mDataProp": "title", "sTitle": "Title", "sClass": "sb-title"},
/* creator */ {"mDataProp": "creator", "sTitle": "Creator", "sClass": "sb-creator"},
/* album */ {"mDataProp": "album", "sTitle": "Album", "sClass": "sb-album"},
/* cue in */ {"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
/* cue out */ {"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
/* fade in */ {"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"},
/* Mime */ {"mDataProp" : "mime", "sTitle" : "Mime", "bVisible": false, "sClass": "sb-mime"}
/* starts */ {"mDataProp": "starts", "sTitle": $.i18n._("Start"), "sClass": "sb-starts", "sWidth": "60px"},
/* ends */ {"mDataProp": "ends", "sTitle": $.i18n._("End"), "sClass": "sb-ends", "sWidth": "60px"},
/* runtime */ {"mDataProp": "runtime", "sTitle": $.i18n._("Duration"), "sClass": "library_length sb-length", "sWidth": "65px"},
/* title */ {"mDataProp": "title", "sTitle": $.i18n._("Title"), "sClass": "sb-title"},
/* creator */ {"mDataProp": "creator", "sTitle": $.i18n._("Creator"), "sClass": "sb-creator"},
/* album */ {"mDataProp": "album", "sTitle": $.i18n._("Album"), "sClass": "sb-album"},
/* cue in */ {"mDataProp": "cuein", "sTitle": $.i18n._("Cue In"), "bVisible": false, "sClass": "sb-cue-in"},
/* cue out */ {"mDataProp": "cueout", "sTitle": $.i18n._("Cue Out"), "bVisible": false, "sClass": "sb-cue-out"},
/* fade in */ {"mDataProp": "fadein", "sTitle": $.i18n._("Fade In"), "bVisible": false, "sClass": "sb-fade-in"},
/* fade out */ {"mDataProp": "fadeout", "sTitle": $.i18n._("Fade Out"), "bVisible": false, "sClass": "sb-fade-out"},
/* Mime */ {"mDataProp" : "mime", "sTitle" : $.i18n._("Mime"), "bVisible": false, "sClass": "sb-mime"}
],
"bJQueryUI": true,
@ -527,7 +527,7 @@ var AIRTIME = (function(AIRTIME){
$node = $(nRow.children[0]);
$node.html('');
sSeparatorHTML = '<span>Show Empty</span>';
sSeparatorHTML = '<span>'+$.i18n._("Show Empty")+'</span>';
cl = cl + " sb-empty odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
@ -539,7 +539,7 @@ var AIRTIME = (function(AIRTIME){
$node = $(nRow.children[0]);
$node.html('');
sSeparatorHTML = '<span>Recording From Line In</span>';
sSeparatorHTML = '<span>'+$.i18n._("Recording From Line In")+'</span>';
cl = cl + " sb-record odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
@ -554,7 +554,7 @@ var AIRTIME = (function(AIRTIME){
if (!isAudioSupported(aData.mime)) {
$image.html('<span class="ui-icon ui-icon-locked"></span>');
} else {
$image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
$image.html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
.click(function() {
open_show_preview(aData.instance, aData.pos);
return false;
@ -565,7 +565,7 @@ var AIRTIME = (function(AIRTIME){
$image.html('<span class="ui-icon ui-icon-alert"></span>');
$image.find(".ui-icon-alert").qtip({
content: {
text: "Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't \"watched\" anymore."
text: $.i18n._("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't \"watched\" anymore.")
},
style: {
classes: "ui-tooltip-dark"
@ -877,7 +877,7 @@ var AIRTIME = (function(AIRTIME){
//can't add items outside of shows.
if (prev.find("td:first").hasClass("dataTables_empty")
|| prev.length === 0) {
alert("Cannot schedule outside a show.");
alert($.i18n._("Cannot schedule outside a show."));
ui.item.remove();
return;
}
@ -932,10 +932,10 @@ var AIRTIME = (function(AIRTIME){
}
if (selected.length === 1) {
message = "Moving "+selected.length+" Item.";
message = $.i18n._("Moving ")+selected.length+$.i18n._(" Item.");
}
else {
message = "Moving "+selected.length+" Items.";
message = $.i18n._("Moving ")+selected.length+$.i18n._(" Items.");
}
draggingContainer = $('<tr/>')
@ -983,28 +983,28 @@ var AIRTIME = (function(AIRTIME){
$menu = $("<div class='btn-toolbar'/>");
$menu.append("<div class='btn-group'>" +
"<button class='btn btn-small dropdown-toggle' id='timeline-select' data-toggle='dropdown'>" +
"Select <span class='caret'></span>" +
$.i18n._("Select")+" <span class='caret'></span>" +
"</button>" +
"<ul class='dropdown-menu'>" +
"<li id='timeline-sa'><a href='#'>Select all</a></li>" +
"<li id='timeline-sn'><a href='#'>Select none</a></li>" +
"<li id='timeline-sa'><a href='#'>"+$.i18n._("Select all")+"</a></li>" +
"<li id='timeline-sn'><a href='#'>"+$.i18n._("Select none")+"</a></li>" +
"</ul>" +
"</div>")
.append("<div class='btn-group'>" +
"<button title='Remove overbooked tracks' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<button title='"+$.i18n._("Remove overbooked tracks")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<i class='icon-white icon-cut'></i></button></div>")
.append("<div class='btn-group'>" +
"<button title='Remove selected scheduled items' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<button title='"+$.i18n._("Remove selected scheduled items")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<i class='icon-white icon-trash'></i></button></div>");
//if 'Add/Remove content' was chosen from the context menu
//in the Calendar do not append these buttons
if ($(".ui-dialog-content").length === 0) {
$menu.append("<div class='btn-group'>" +
"<button title='Jump to the current playing track' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<button title='"+$.i18n._("Jump to the current playing track")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<i class='icon-white icon-step-forward'></i></button></div>")
.append("<div class='btn-group'>" +
"<button title='Cancel current show' class='ui-state-disabled btn btn-small btn-danger' disabled='disabled'>" +
"<button title='"+$.i18n._("Cancel current show")+"' class='ui-state-disabled btn btn-small btn-danger' disabled='disabled'>" +
"<i class='icon-white icon-ban-circle'></i></button></div>");
}
@ -1019,7 +1019,7 @@ var AIRTIME = (function(AIRTIME){
.click(function() {
var $tr,
data,
msg = 'Cancel Current Show?';
msg = $.i18n._('Cancel Current Show?');
if (AIRTIME.button.isDisabled('icon-ban-circle', true) === true) {
return;
@ -1031,7 +1031,7 @@ var AIRTIME = (function(AIRTIME){
data = $tr.data("aData");
if (data.record === true) {
msg = 'Stop recording current show?';
msg = $.i18n._('Stop recording current show?');
}
if (confirm(msg)) {