CC-1960: Internationalize Airtime / Support translations

-enabled i18n for datatables, colVis, columnFilter, and fullCalendar
-fixed typos in full-calendar-functions.js
This commit is contained in:
denise 2012-11-20 16:40:02 -05:00
parent 57fdab0ddf
commit f40d1f8dd4
10 changed files with 142 additions and 32 deletions

View File

@ -103,8 +103,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/locale/translation-table?'.$CC_CONFIG['airtime_version'].rand(5, 10),'text/javascript');
$view->headScript()->appendScript("$.i18n.setDictionary(lang_dict)");
$view->headScript()->appendFile($baseUrl.'/locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendFile($baseUrl.'/locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
$view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
$view->headScript()->appendScript("var baseUrl='$baseUrl'");
//scripts for now playing bar

View File

@ -5,11 +5,23 @@ class LocaleController extends Zend_Controller_Action
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('language-table', 'json')
$ajaxContext->addActionContext('general-translation-table', 'json')
->addActionContext('datatables-translation-table', 'json')
->initContext();
}
public function translationTableAction()
public function datatablesTranslationTableAction()
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header("Content-type: text/javascript");
$baseUrl = Application_Common_OsPath::getBaseDir();
echo "var datatables_dict =" .
file_get_contents($_SERVER['DOCUMENT_ROOT'].$baseUrl.'/js/datatables/i18n/de_DE.txt');
}
public function generalTranslationTableAction()
{
$translations = array (
//common/common.js
@ -196,6 +208,48 @@ class LocaleController extends Zend_Controller_Action
//already in schedule/add-show.js
//"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"),
//schedule/schedule.js
"January" => _("January"),
"February" => _("February"),
"March" => _("March"),
"April" => _("April"),
"May" => _("May"),
"June" => _("June"),
"July" => _("July"),
"August" => _("August"),
"September" => _("September"),
"October" => _("October"),
"November" => _("November"),
"December" => _("December"),
"Jan" => _("Jan"),
"Feb" => _("Feb"),
"Mar" => _("Mar"),
"Apr" => _("Apr"),
"May" => _("May"),
"Jun" => _("Jun"),
"Jul" => _("Jul"),
"Aug" => _("Aug"),
"Sep" => _("Sep"),
"Oct" => _("Oct"),
"Nov" => _("Nov"),
"Dec" => _("Dec"),
"today" => _("today"),
"day" => _("day"),
"week" => _("week"),
"month" => _("month"),
"Sunday" => _("Sunday"),
"Monday" => _("Monday"),
"Tuesday" => _("Tuesday"),
"Wednesday" => _("Wednesday"),
"Thursday" => _("Thursday"),
"Friday" => _("Friday"),
"Saturday" => _("Saturday"),
"Sun" => _("Sun"),
"Mon" => _("Mon"),
"Tue" => _("Tue"),
"Wed" => _("Wed"),
"Thu" => _("Thu"),
"Fri" => _("Fri"),
"Sat" => _("Sat"),
"Shows longer than their scheduled time will be cut off by a following show." => _("Shows longer than their scheduled time will be cut off by a following show."),
"Cancel Current Show?" => _("Cancel Current Show?"),
"Stop recording current show?" => _("Stop recording current show?"),
@ -221,7 +275,7 @@ class LocaleController extends Zend_Controller_Action
"Show Empty" => _("Show Empty"),
"Recording From Line In" => _("Recording From Line In"),
"Track preview" => _("Track preview"),
//already in library/spl/js
//already in library/spl.js
//"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."
//=> _("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."),
"Cannot schedule outside a show." => _("Cannot schedule outside a show."),
@ -230,7 +284,7 @@ class LocaleController extends Zend_Controller_Action
" Item." => _(" Item."),
" Items." => _(" Items."),
//already in library/library.js
"Select" => _("Select"),
//"Select" => _("Select"),
"Select all" => _("Select all"),
"Select none" => _("Select none"),
"Remove overbooked tracks" => _("Remove overbooked tracks"),
@ -251,12 +305,15 @@ class LocaleController extends Zend_Controller_Action
"DJ" => _("DJ"),
"Program Manager" => _("Program Manager"),
"Guest" => _("Guest"),
//dataTables/ColVis.js
"Show / hide columns" => _("Show / hide columns"),
//datatables.columnFilter.js
"From {from} to {to}" => _("From {from} to {to}")
);
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header("Content-type: text/javascript");
echo "var lang_dict=".json_encode($translations);
echo "var general_dict=".json_encode($translations);
}
}

View File

@ -17,10 +17,10 @@ if (isset($this->obj)) {
</div>
<?php if (isset($this->obj)) : ?>
<div class='btn-group pull-right'>
<button class="btn btn-inverse" title='Shuffle playlist' type="button" id="playlist_shuffle_button">Shuffle</button>
<button class="btn btn-inverse" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><? echo _("Shuffle") ?></button>
</div>
<div class='btn-group pull-right'>
<button class="btn btn-inverse" title='Save playlist' type="button" id="save_button"><? echo _("Save") ?></button>
<button class="btn btn-inverse" title='<?php echo _("Save playlist") ?>' type="button" id="save_button"><? echo _("Save") ?></button>
</div>
<div class='btn-group pull-right'>
<button id="spl_delete" class="btn" role="button" aria-disabled="false"><? echo _("Delete") ?></button>

View File

@ -465,6 +465,7 @@ var AIRTIME = (function(AIRTIME) {
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
],
"bProcessing": true,
"bServerSide": true,
@ -664,10 +665,7 @@ var AIRTIME = (function(AIRTIME) {
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": false,
"oLanguage": {
"sSearch": "",
"sLengthMenu": "Show _MENU_"
},
"oLanguage": datatables_dict,
// 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

@ -154,12 +154,12 @@ function viewDisplay( view ) {
var calendarEl = this;
var select = $('<select class="schedule_change_slots input_select"/>')
.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>')
.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;
@ -424,7 +424,7 @@ function addQtipToSCIcons(ele){
if($(ele).hasClass("progress")){
$(ele).qtip({
content: {
text: $.i18n.("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: $.i18n.("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', $.i18n.("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,13 +468,13 @@ function addQtipToSCIcons(ele){
}else if($(ele).hasClass("sc-error")){
$(ele).qtip({
content: {
text: $.i18n.("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', $.i18n.("There was error while uploading to soundcloud.")+"<br>"+$.i18n._("Error code: ")+json.error_code+
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>");
}
}
@ -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($.i18n.("The show instance doesn't exist anymore!"));
alert($.i18n._("The show instance doesn't exist anymore!"));
window.location.reload();
}

View File

@ -262,6 +262,58 @@ function createFullCalendar(data){
agenda: 'H:mm{ - H:mm}',
month: 'H:mm{ - H:mm}'
},
monthNames: [
$.i18n._('January'),
$.i18n._('February'),
$.i18n._('March'),
$.i18n._('April'),
$.i18n._('May'),
$.i18n._('June'),
$.i18n._('July'),
$.i18n._('August'),
$.i18n._('September'),
$.i18n._('October'),
$.i18n._('November'),
$.i18n._('December')
],
monthNamesShort: [
$.i18n._('Jan'),
$.i18n._('Feb'),
$.i18n._('Mar'),
$.i18n._('Apr'),
$.i18n._('May'),
$.i18n._('Jun'),
$.i18n._('Jul'),
$.i18n._('Aug'),
$.i18n._('Sep'),
$.i18n._('Oct'),
$.i18n._('Nov'),
$.i18n._('Dec')
],
buttonText: {
today: $.i18n._('today'),
month: $.i18n._('month'),
week: $.i18n._('week'),
day: $.i18n._('day')
},
dayNames: [
$.i18n._('Sunday'),
$.i18n._('Monday'),
$.i18n._('Tuesday'),
$.i18n._('Wednesday'),
$.i18n._('Thursday'),
$.i18n._('Friday'),
$.i18n._('Saturday')
],
dayNamesShort: [
$.i18n._('Sun'),
$.i18n._('Mon'),
$.i18n._('Tue'),
$.i18n._('Wed'),
$.i18n._('Thu'),
$.i18n._('Fri'),
$.i18n._('Sat')
],
contentHeight: mainHeight,
theme: true,
lazyFetching: false,

View File

@ -86,9 +86,7 @@ function populateUserTable() {
"bJQueryUI": true,
"bAutoWidth": false,
"bLengthChange": false,
"oLanguage": {
"sSearch": ""
},
"oLanguage": datatables_dict,
"sDom": '<"H"lf<"dt-process-rel"r>>t<"F"ip>',
});

View File

@ -30,4 +30,8 @@ The new _fnDomBaseButton looks like this:
return nButton;
},
--------------------------------------------------------------------------------
* Line 96 has changed
- "buttonText": "Show / hide columns",
+ "buttonText": $.i18n._("Show / hide columns"),

View File

@ -95,7 +95,7 @@ ColVis = function( oDTSettings, oInit )
* @type String
* @default Show / hide columns
*/
"buttonText": "Show / hide columns",
"buttonText": $.i18n._("Show / hide columns"),
/**
* Flag to say if the collection is hidden

View File

@ -585,7 +585,7 @@
sRangeSeparator: "~",
iFilteringDelay: 500,
aoColumns: null,
sRangeFormat: "From {from} to {to}"
sRangeFormat: $.i18n._("From {from} to {to}")
};
properties = $.extend(defaults, options);