1
0
Fork 0
forked from 0x2620/oxjs

add localization to Ox

This commit is contained in:
j 2013-05-09 13:03:33 +00:00
commit 4d8c716d0b
31 changed files with 499 additions and 352 deletions

View file

@ -152,8 +152,8 @@ Ox.Calendar = function(options, self) {
},
name: function(i) {
return i > -2
? Ox.formatOrdinal(i + 2) + ' Millennium'
: Ox.formatOrdinal(-i - 1) + ' Millennium BC'
? Ox._('{0} Millennium', Ox.formatOrdinal(i + 2))
: Ox._('{0} Millennium BC', Ox.formatOrdinal(-i - 1))
},
value: function(date) {
return Math.floor(date.getUTCFullYear() / 1000) - 1;
@ -167,8 +167,8 @@ Ox.Calendar = function(options, self) {
},
name: function(i) {
return i > -20
? Ox.formatOrdinal(i + 20) + ' Century'
: Ox.formatOrdinal(-i - 19) + ' Century BC'
? Ox._('{0} Century', Ox.formatOrdinal(i + 20))
: Ox._('{0} Century BC', Ox.formatOrdinal(-i - 19))
},
value: function(date) {
return Math.floor(date.getUTCFullYear() / 100) - 19;
@ -334,10 +334,10 @@ Ox.Calendar = function(options, self) {
self.$menu = Ox.Select({
items: [
{id: 'date', title: 'Show Dates'},
{id: 'place', title: 'Show Places'},
{id: 'person', title: 'Show People'},
{id: 'other', title: 'Show Other'}
{id: 'date', title: Ox._('Show Dates')},
{id: 'place', title: Ox._('Show Places')},
{id: 'person', title: Ox._('Show People')},
{id: 'other', title: Ox._('Show Other')}
],
max: -1,
min: 1,
@ -536,7 +536,7 @@ Ox.Calendar = function(options, self) {
self.$eventControls = {
name: Ox.Label({
textAlign: 'center',
tooltip: 'Click to pan, doubleclick to zoom'
tooltip: Ox._('Click to pan, doubleclick to zoom')
})
.addClass('OxEventControl OxEventName')
.css({bottom: 20 + (self.options.showZoombar * 16) + 'px'})
@ -551,7 +551,7 @@ Ox.Calendar = function(options, self) {
.appendTo(that),
deselectButton: Ox.Button({
title: 'close',
tooltip: 'Deselect',
tooltip: Ox._('Deselect'),
type: 'image'
})
.addClass('OxEventControl OxEventDeselectButton')

View file

@ -76,7 +76,7 @@ Ox.CalendarEditor = function(options, self) {
},
id: 'type',
operator: '+',
title: 'Type',
title: Ox._('Type'),
titleImage: 'icon',
visible: true,
width: 16
@ -90,7 +90,7 @@ Ox.CalendarEditor = function(options, self) {
id: 'name',
operator: '+',
removable: false,
title: 'Name',
title: Ox._('Name'),
visible: true,
width: 144
},
@ -101,7 +101,7 @@ Ox.CalendarEditor = function(options, self) {
},
id: 'alternativeNames',
operator: '+',
title: 'Alternative Names',
title: Ox._('Alternative Names'),
visible: true,
width: 144
},
@ -111,7 +111,7 @@ Ox.CalendarEditor = function(options, self) {
sort: function(value) {
return Ox.parseDate(value);
},
title: 'Start',
title: Ox._('Start'),
visible: true,
width: 144
},
@ -121,7 +121,7 @@ Ox.CalendarEditor = function(options, self) {
sort: function(value) {
return Ox.parseDate(value);
},
title: 'End',
title: Ox._('End'),
visible: true,
width: 144
},
@ -140,7 +140,7 @@ Ox.CalendarEditor = function(options, self) {
sort: function(value, data) {
return Ox.parseDate(data.end) - Ox.parseDate(data.start);
},
title: 'Duration',
title: Ox._('Duration'),
visible: true,
width: 256
},
@ -150,7 +150,7 @@ Ox.CalendarEditor = function(options, self) {
},
id: 'user',
operator: '+',
title: 'User',
title: Ox._('User'),
visible: false,
width: 96
},
@ -160,7 +160,7 @@ Ox.CalendarEditor = function(options, self) {
},
id: 'created',
operator: '-',
title: 'Date Created',
title: Ox._('Date Created'),
visible: false,
width: 128
},
@ -170,7 +170,7 @@ Ox.CalendarEditor = function(options, self) {
},
id: 'modified',
operator: '-',
title: 'Date Modified',
title: Ox._('Date Modified'),
visible: false,
width: 128
}
@ -180,7 +180,7 @@ Ox.CalendarEditor = function(options, self) {
align: 'right',
id: 'matches',
operator: '-',
title: 'Matches',
title: Ox._('Matches'),
visible: true,
width: 64
});
@ -193,9 +193,9 @@ Ox.CalendarEditor = function(options, self) {
elements: [
self.$findSelect = Ox.Select({
items: [
{id: 'all', title: 'Find: All'},
{id: 'name', title: 'Find: Name'},
{id: 'alternativeNames', title: 'Find: Alternative Names'},
{id: 'all', title: Ox._('Find: All')},
{id: 'name', title: Ox._('Find: Name')},
{id: 'alternativeNames', title: Ox._('Find: Alternative Names')},
],
overlap: 'right',
type: 'image'
@ -209,7 +209,7 @@ Ox.CalendarEditor = function(options, self) {
}),
self.$findInput = Ox.Input({
clear: true,
placeholder: 'Find in List',
placeholder: Ox._('Find in List'),
width: 234
})
.bindEvent({
@ -271,9 +271,7 @@ Ox.CalendarEditor = function(options, self) {
self.$status = Ox.Element()
.css({paddingTop: '2px', margin: 'auto', fontSize: '9px', textAlign: 'center'})
.html(
Ox.formatNumber(self.options.events.length) + ' Event' + (
self.options.events.length == 1 ? '' : 's'
)
Ox.formatCount(self.options.events, Ox._('Event'), Ox._('Events'))
)
.appendTo(self.$listStatusbar);
@ -320,7 +318,7 @@ Ox.CalendarEditor = function(options, self) {
.appendTo(self.$eventTitle);
self.$deselectEventButton = Ox.Button({
title: 'close',
tooltip: 'Done',
tooltip: Ox._('Done'),
type: 'image'
})
.css({float: 'left', margin: '4px 4px 4px 0'})
@ -339,13 +337,13 @@ Ox.CalendarEditor = function(options, self) {
items: [
self.$nameInput = Ox.Input({
id: 'name',
label: 'Name',
label: Ox._('Name'),
labelWidth: 64,
width: 240
}),
self.$alternativeNamesInput = Ox.ArrayInput({
id: 'alternativeNames',
label: 'Alternative Names',
label: Ox._('Alternative Names'),
max: 10,
values: [],
width: 240
@ -353,31 +351,31 @@ Ox.CalendarEditor = function(options, self) {
Ox.Select({
id: 'type',
items: [
{id: 'date', title: 'Date'},
{id: 'place', title: 'Place'},
{id: 'person', title: 'Person'},
{id: 'other', title: 'Other'}
{id: 'date', title: Ox._('Date')},
{id: 'place', title: Ox._('Place')},
{id: 'person', title: Ox._('Person')},
{id: 'other', title: Ox._('Other')}
],
label: 'Type',
label: Ox._('Type'),
labelWidth: 64,
width: 240
}),
self.$startInput = Ox.Input({
id: 'start',
label: 'Start',
label: Ox._('Start'),
labelWidth: 64,
width: 240
}),
self.$endInput = Ox.Input({
id: 'end',
label: 'End',
label: Ox._('End'),
labelWidth: 64,
width: 240
}),
self.$durationInput = Ox.Input({
disabled: true,
id: 'durationText',
label: 'Duration',
label: Ox._('Duration'),
labelWidth: 64,
width: 240
})
@ -435,7 +433,7 @@ Ox.CalendarEditor = function(options, self) {
self.$matchesInput = Ox.Input({
disabled: true,
id: 'matches',
label: 'Matches',
label: Ox._('Matches'),
labelWidth: 64,
type: 'int',
width: 240
@ -450,7 +448,7 @@ Ox.CalendarEditor = function(options, self) {
});
self.$removeEventButton = Ox.Button({
title: 'Remove Event',
title: Ox._('Remove Event'),
width: 90
})
.css({float: 'left', margin: '4px'})
@ -461,7 +459,7 @@ Ox.CalendarEditor = function(options, self) {
.appendTo(self.$eventStatusbar);
self.$newEventButton = Ox.Button({
title: 'New Event',
title: Ox._('New Event'),
width: 70
})
.css({float: 'right', margin: '4px'})
@ -472,13 +470,13 @@ Ox.CalendarEditor = function(options, self) {
if (self.options.mode == 'define') {
self.$defineEventButton = Ox.Button({
title: 'Define Event',
title: Ox._('Define Event'),
width: 80
})
.css({float: 'right', margin: '4px 0 4px 0'})
.bindEvent({
click: function() {
if (this.options('title') == 'Define Event') {
if (this.options('title') == Ox._('Define Event')) {
defineEvent();
} else {
clearEvent();
@ -611,7 +609,7 @@ Ox.CalendarEditor = function(options, self) {
alternativeNames: [], type: '',
start: '', end: ''
};
self.$defineEventButton.options({disabled: true, title: 'Clear Event'});
self.$defineEventButton.options({disabled: true, title: Ox._('Clear Event')});
self.options.editEvent(encodeValues(values), function() {
Ox.forEach(values, function(value, key) {
self.$list.value(self.options.selected, key, value);
@ -619,7 +617,7 @@ Ox.CalendarEditor = function(options, self) {
self.$list.reloadList();
self.$calendar.removeEvent();
self.$eventForm.hide();
self.$defineEventButton.options({disabled: false, title: 'Define Event'});
self.$defineEventButton.options({disabled: false, title: Ox._('Define Event')});
});
}
@ -647,7 +645,7 @@ Ox.CalendarEditor = function(options, self) {
event.end = Ox.formatDate(endTime, '%Y-%m-%d %H:%M:%S', true);
self.$list.options({items: Ox.clone(self.options.events, true)});
self.$calendar.addEvent(event);
self.$defineEventButton.options({title: 'Clear Event'});
self.$defineEventButton.options({title: Ox._('Clear Event')});
}
function editEvent(key, value) {
@ -698,9 +696,7 @@ Ox.CalendarEditor = function(options, self) {
function initList(data) {
self.$status.html(
Ox.formatNumber(data.items) + ' Event' + (
data.items == 1 ? '' : 's'
)
Ox.formatCount(data.items, Ox._('Event'), Ox._('Events'))
);
}