CC-1960: Internationalize Airtime / Support translations

-added gettext wrapper function to all strings missing it
-i18n of jquery timepicker and datepicker
-i18n of jquery datatables columnFilter input place holder labels
This commit is contained in:
denise 2012-11-22 17:32:24 -05:00
parent f3fe05c014
commit dd0e71efcc
16 changed files with 136 additions and 64 deletions

View File

@ -51,6 +51,7 @@ class LocaleController extends Zend_Controller_Action
//"Adding 1 Item" => _("Adding 1 Item"),
//"Adding %s Items" => _("Adding %s Items"),
//library/library.js
" Add to selected show" => _(" Add to selected show"),
"Select" => _("Select"),
"Select this page" => _("Select this page"),
"Deselect this page" => _("Deselect this page"),
@ -100,9 +101,8 @@ class LocaleController extends Zend_Controller_Action
"Input must be in the format: yyyy-mm-dd" => _("Input must be in the format: yyyy-mm-dd"),
"Input must be in the format: hh:mm:ss.t" => _("Input must be in the format: hh:mm:ss.t"),
//library/plupload.js
"You are currently uploading files." => _("You are currently uploading files."),
"Going to another screen will cancel the upload process." => _("Going to another screen will cancel the upload process."),
"Are you sure you want to leave the page?" => _("Are you sure you want to leave the page?"),
"You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"
=> _("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"),
//library/spl.js
"please put in a time '00:00:00 (.0)'" => _("please put in a time '00:00:00 (.0)'"),
"please put in a time in seconds '00 (.0)'" => _("please put in a time in seconds '00 (.0)'"),
@ -127,8 +127,8 @@ class LocaleController extends Zend_Controller_Action
=> _("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show."),
"A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library."
=> _("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library."),
"If your criteria is too strict, Airtime may not be able to fill up the desired smart block length. Hence, if you check this option, tracks will be used more than once."
=> _("If your criteria is too strict, Airtime may not be able to fill up the desired smart block length. Hence, if you check this option, tracks will be used more than once."),
"The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."
=> _("The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."),
"Smart block shuffled" => _("Smart block shuffled"),
"Smart block generated and criteria saved" => _("Smart block generated and criteria saved"),
"Smart block saved" => _("Smart block saved"),
@ -302,7 +302,26 @@ class LocaleController extends Zend_Controller_Action
//dataTables/ColVis.js
"Show / hide columns" => _("Show / hide columns"),
//datatables.columnFilter.js
"From {from} to {to}" => _("From {from} to {to}")
"From {from} to {to}" => _("From {from} to {to}"),
" kbps" => _(" kbps"),
" yyyy-mm-dd" => _(" yyyy-mm-dd"),
" hh:mm:ss.t" => _(" hh:mm:ss.t"),
" kHz" => _(" kHz"),
//datepicker
//months are already in schedule/schedule.js
"Su" => _("Su"),
"Mo" => _("Mo"),
"Tu" => _("Tu"),
"We" => _("We"),
"Th" => _("Th"),
"Fr" => _("Fr"),
"Sa" => _("Sa"),
"Close" => _("Close"),
//timepicker
"Hour" => _("Hour"),
"Minute" => _("Minute"),
"Done" => _("Done")
);
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

View File

@ -12,7 +12,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$relativeDates = array();
$relativeDates[""] = "";
for ($i=0; $i<=30; $i++) {
$relativeDates["$i days"] = "+$i days";
$relativeDates["$i days"] = "+$i "._("days");
}
for ($i=1; $i<=10; $i++) {

View File

@ -11,9 +11,9 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
'label' => _('Repeat Type:'),
'class' => ' input_select',
'multiOptions' => array(
"0" => "weekly",
"1" => "bi-weekly",
"2" => "monthly"
"0" => _("weekly"),
"1" => _("bi-weekly"),
"2" => _("monthly")
),
));
@ -25,13 +25,13 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
'label' => _('Select Days:'),
'required' => false,
'multiOptions' => array(
"0" => "Sun",
"1" => "Mon",
"2" => "Tue",
"3" => "Wed",
"4" => "Thu",
"5" => "Fri",
"6" => "Sat",
"0" => _("Sun"),
"1" => _("Mon"),
"2" => _("Tue"),
"3" => _("Wed"),
"4" => _("Thu"),
"5" => _("Fri"),
"6" => _("Sat"),
),
));

View File

@ -27,7 +27,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty'),
'value' => 'Untitled Show',
'value' => _('Untitled Show'),
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
));

View File

@ -45,8 +45,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel(
sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.'), '<br>'));
$third_party_api->setMultiOptions(array("Disabled",
"Enabled"));
$third_party_api->setMultiOptions(array(_("Disabled"),
_("Enabled")));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
@ -105,13 +105,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
private function getWeekStartDays()
{
$days = array(
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
_('Sunday'),
_('Monday'),
_('Tuesday'),
_('Wednesday'),
_('Thursday'),
_('Friday'),
_('Saturday')
);
return $days;
@ -120,7 +120,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
private function getLocales()
{
$locales = array(
'en_CA' => 'English'
'en_CA' => _('English')
);
return $locales;

View File

@ -50,7 +50,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
list($hours, $min, $sec) = $arr;
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
return $di->format("%Hh %Im");
return $di->format("%H"._("h")." %I"._("m"));
}
return "";

View File

@ -1,4 +1,4 @@
<div id="register_popup" class="dialogPopup register-dialog" title="Register Airtime" style="display: none;">
<div id="register_popup" class="dialogPopup register-dialog" title="<?php _("Register Airtime") ?>" style="display: none;">
<form id="register-form" method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
<fieldset>
<dl class="zend_form">

View File

@ -11,6 +11,35 @@ $(document).ready(function() {
setTimeout(function(){$(".success").fadeOut("slow", function(){$(this).empty()});}, 5000);
});
/*
* i18n_months and i18n_days_short are used in jquery datepickers
* which we use in multiple places
*/
var i18n_months = [
$.i18n._("January"),
$.i18n._("February"),
$.i18n._("March"),
$.i18n._("April"),
$.i18n._("May"),
$.i18n._("June"),
$.i18n._("July"),
$.i18n._("August"),
$.i18n._("September"),
$.i18n._("October"),
$.i18n._("November"),
$.i18n._("December")
];
var i18n_days_short = [
$.i18n._("Su"),
$.i18n._("Mo"),
$.i18n._("Tu"),
$.i18n._("We"),
$.i18n._("Th"),
$.i18n._("Fr"),
$.i18n._("Sa"),
]
function adjustDateToServerDate(date, serverTimezoneOffset){
//date object stores time in the browser's localtime. We need to artificially shift
//it to

View File

@ -21,7 +21,7 @@ var AIRTIME = (function(AIRTIME) {
AIRTIME.button.disableButton("btn-group #library-plus", false);
}
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' Add to selected show');
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), $.i18n._(' Add to selected show'));
};
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {

View File

@ -156,6 +156,9 @@ function plot(datasets){
plotByChoice(true);
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onSelect: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
@ -164,8 +167,11 @@ function plot(datasets){
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
showButtonText: $.i18n._("Done"),
showLeadingZero: false,
defaultTime: '0:00'
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
};
listenerstat_content.find(dateStartId).datepicker(oBaseDatePickerSettings);

View File

@ -150,6 +150,9 @@ $(document).ready(function(){
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onSelect: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
@ -158,8 +161,11 @@ $(document).ready(function(){
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
showButtonText: $.i18n._("Done"),
showLeadingZero: false,
defaultTime: '0:00'
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
};
oTable = AIRTIME.history.historyTable();

View File

@ -32,8 +32,11 @@ function createDateInput(el, onSelect) {
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
onSelect: onSelect,
dateFormat: 'yy-mm-dd',
closeText: 'Close',
showButtonPanel: true,
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
closeText: $.i18n._('Close'),
//showButtonPanel: true,
firstDay: weekStart
});
}
@ -318,7 +321,9 @@ function setAddShowEvents() {
});
form.find('input[name^="add_show_rebroadcast_time"]').timepicker({
amPmText: ['', ''],
defaultTime: ''
defaultTime: '',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
});
form.find(".add_absolute_rebroadcast_day").click(function(){

View File

@ -262,20 +262,8 @@ 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')
],
//i18n_months is in common.js
monthNames: i18n_months,
monthNamesShort: [
$.i18n._('Jan'),
$.i18n._('Feb'),

View File

@ -30,6 +30,9 @@ AIRTIME = (function(AIRTIME) {
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onClick: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
@ -38,8 +41,11 @@ AIRTIME = (function(AIRTIME) {
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
showButtonText: $.i18n._("Done"),
showLeadingZero: false,
defaultTime: '0:00'
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
};
function setWidgetSize() {

View File

@ -5,8 +5,8 @@ Running a diff between the original column filter plugin (dataTables.columnFilte
our modified one (dataTables.columnFilter.js):
denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u dataTables.columnFilter_orig.js dataTables.columnFilter.js
--- dataTables.columnFilter_orig.js 2012-09-11 11:53:16.476101955 -0400
+++ dataTables.columnFilter.js 2012-10-04 12:15:13.270199949 -0400
--- dataTables.columnFilter_orig.js 2012-10-17 11:41:05.000000000 -0400
+++ dataTables.columnFilter.js 2012-11-22 12:20:03.997107451 -0500
@@ -103,7 +103,8 @@
label = label.replace(/(^\s*)|(\s*$)/g, "");
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
@ -88,13 +88,13 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
+
+ var label = "";
+ if (th.attr('id') == "bit_rate") {
+ label = " bps";
+ label = $.i18n._(" kbps");
+ } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
+ label = " yyyy-mm-dd";
+ label = $.i18n._(" yyyy-mm-dd");
+ } else if (th.attr('id') == "length") {
+ label = " hh:mm:ss.t";
+ label = $.i18n._(" hh:mm:ss.t");
+ } else if (th.attr('id') == "sample_rate") {
+ label = " Hz";
+ label = $.i18n._(" kHz");
+ }
+
th.html(_fnRangeLabelPart(0));
@ -133,7 +133,20 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
+ }
});
@@ -566,7 +585,7 @@
sRangeSeparator: "~",
iFilteringDelay: 500,
aoColumns: null,
- sRangeFormat: "From {from} to {to}"
+ sRangeFormat: $.i18n._("From {from} to {to}")
};
properties = $.extend(defaults, options);
@@ -730,4 +749,4 @@
-})(jQuery);
\ No newline at end of file
+})(jQuery);

View File

@ -184,13 +184,13 @@
var label = "";
if (th.attr('id') == "bit_rate") {
label = " kbps";
label = $.i18n._(" kbps");
} else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
label = " yyyy-mm-dd";
label = $.i18n._(" yyyy-mm-dd");
} else if (th.attr('id') == "length") {
label = " hh:mm:ss.t";
label = $.i18n._(" hh:mm:ss.t");
} else if (th.attr('id') == "sample_rate") {
label = " kHz";
label = $.i18n._(" kHz");
}
th.html(_fnRangeLabelPart(0));