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

@ -6,7 +6,7 @@
function scheduleRefetchEvents(json) {
if(json.show_error == true){
alert("The show instance doesn't exist anymore!");
alert($.i18n._("The show instance doesn't exist anymore!"));
}
if(json.show_id) {
var dialog_id = parseInt($("#add_show_id").val(), 10);
@ -41,7 +41,7 @@ function openAddShowForm() {
function makeAddShowButton(){
$('.fc-header-left')
.append('<span class="fc-header-space"></span>')
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>Show</a></span>')
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>'+$.i18n._("Show")+'</a></span>')
.find('span.fc-button:last > a')
.click(function(){
openAddShowForm();
@ -154,12 +154,12 @@ function viewDisplay( view ) {
var calendarEl = this;
var select = $('<select class="schedule_change_slots input_select"/>')
.append('<option value="1">1m</option>')
.append('<option value="5">5m</option>')
.append('<option value="10">10m</option>')
.append('<option value="15">15m</option>')
.append('<option value="30">30m</option>')
.append('<option value="60">60m</option>')
.append('<option value="1">'+$.i18n._("1m").'</option>')
.append('<option value="5">'+$.i18n._("5m").'</option>')
.append('<option value="10">'+$.i18n._("10m").'</option>')
.append('<option value="15">'+$.i18n._("15m").'</option>')
.append('<option value="30">'+$.i18n._("30m").'</option>')
.append('<option value="60">'+$.i18n._("60m").'</option>')
.change(function(){
var slotMin = $(this).val();
var opt = view.calendar.options;
@ -261,7 +261,7 @@ function eventRender(event, element, view) {
if (event.soundcloud_id === -1) {
$(element)
.find(".fc-event-time")
.before('<span id="'+event.id+'" title="Show is empty" class="small-icon show-empty"></span>');
.before('<span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else if (event.soundcloud_id > 0) {
} else if (event.soundcloud_id === -2) {
@ -275,7 +275,7 @@ function eventRender(event, element, view) {
if (event.soundcloud_id === -1) {
$(element)
.find(".fc-event-title")
.after('<span id="'+event.id+'" title="Show is empty" class="small-icon show-empty"></span>');
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else if (event.soundcloud_id > 0) {
} else if (event.soundcloud_id === -2) {
@ -424,7 +424,7 @@ function addQtipToSCIcons(ele){
if($(ele).hasClass("progress")){
$(ele).qtip({
content: {
text: "Uploading in progress..."
text: $.i18n.("Uploading in progress...")
},
position:{
adjust: {
@ -442,13 +442,13 @@ function addQtipToSCIcons(ele){
}else if($(ele).hasClass("soundcloud")){
$(ele).qtip({
content: {
text: "Retreiving data from the server...",
text: $.i18n.("Retreiving data from the server..."),
ajax: {
url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
success: function(json, status){
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id);
this.set('content.text', $.i18n.("The soundcloud id for this file is: ")+json.sc_id);
}
}
},
@ -468,14 +468,14 @@ function addQtipToSCIcons(ele){
}else if($(ele).hasClass("sc-error")){
$(ele).qtip({
content: {
text: "Retreiving data from the server...",
text: $.i18n.("Retreiving data from the server..."),
ajax: {
url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post",
data: ({format: "json", id : id, type: "show"}),
success: function(json, status){
this.set('content.text', "There was error while uploading to soundcloud.<br>"+"Error code: "+json.error_code+
"<br>"+"Error msg: "+json.error_msg+"<br>");
this.set('content.text', $.i18n.("There was error while uploading to soundcloud.")+"<br>"+$.i18n._("Error code: ")+json.error_code+
"<br>"+$.i18n._("Error msg: ")+json.error_msg+"<br>");
}
}
},
@ -495,7 +495,7 @@ function addQtipToSCIcons(ele){
}else if ($(ele).hasClass("show-empty")){
$(ele).qtip({
content: {
text: "This show has no scheduled content."
text: $.i18n._("This show has no scheduled content.")
},
position:{
adjust: {
@ -548,7 +548,7 @@ function checkEmptyShowStatus(e) {
//Alert the error and reload the page
//this function is used to resolve concurrency issue
function alertShowErrorAndReload(){
alert("The show instance doesn't exist anymore!");
alert($.i18n.("The show instance doesn't exist anymore!"));
window.location.reload();
}