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:
parent
f3fe05c014
commit
dd0e71efcc
16 changed files with 136 additions and 64 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(){
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue