forked from 0x2620/oxjs
add localization to Ox
This commit is contained in:
parent
b68b827d7b
commit
4d8c716d0b
31 changed files with 499 additions and 352 deletions
|
|
@ -172,8 +172,8 @@ Ox.ArrayEditable = function(options, self) {
|
|||
: ''
|
||||
) + (
|
||||
self.options.editable
|
||||
? 'Click to select' + (
|
||||
item.editable ? ', doubleclick to edit' : ''
|
||||
? Ox._('Click to select') + (
|
||||
item.editable ? Ox._(', doubleclick to edit') : ''
|
||||
)
|
||||
: ''
|
||||
),
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ Ox.FileInput = function(options, self) {
|
|||
title: 'close',
|
||||
type: 'image'
|
||||
})
|
||||
.attr({title: 'Remove File'})
|
||||
.attr({title: Ox._('Remove File')})
|
||||
.css({margin: '-1px -4px 0 0'})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
|
|
@ -206,7 +206,7 @@ Ox.FileInput = function(options, self) {
|
|||
}
|
||||
self.$input = renderInput();
|
||||
} else {
|
||||
self.$button.options({title: 'close'}).attr({title: 'Clear'});
|
||||
self.$button.options({title: 'close'}).attr({title: Ox._('Clear')});
|
||||
self.$input.remove();
|
||||
}
|
||||
that.triggerEvent('change', {value: self.options.value});
|
||||
|
|
@ -257,9 +257,9 @@ Ox.FileInput = function(options, self) {
|
|||
function getTitleText() {
|
||||
var length = self.options.value.length
|
||||
return length == 0
|
||||
? 'No file' + (self.multiple ? 's' : '') + ' selected'
|
||||
? Ox._('No file' + (self.multiple ? 's' : '') + ' selected')
|
||||
: self.multiple
|
||||
? length + ' file' + (length == 1 ? '' : 's')
|
||||
? Ox.formatCount(length, Ox._('file'), Ox._('files'))
|
||||
: self.options.value[0].name;
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ Ox.FileInput = function(options, self) {
|
|||
return $('<input>')
|
||||
.attr(
|
||||
Ox.extend({
|
||||
title: self.multiple ? 'Add Files' : 'Select File',
|
||||
title: self.multiple ? Ox._('Add Files') : Ox._('Select File'),
|
||||
type: 'file'
|
||||
}, self.multiple ? {
|
||||
multiple: true
|
||||
|
|
|
|||
|
|
@ -48,66 +48,66 @@ Ox.Filter = function(options, self) {
|
|||
|
||||
self.conditionOperators = {
|
||||
boolean: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'}
|
||||
{id: '=', title: Ox._('is')},
|
||||
{id: '!=', title: Ox._('is not')}
|
||||
],
|
||||
date: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'},
|
||||
{id: '<', title: 'is before'},
|
||||
{id: '!<', title: 'is not before'},
|
||||
{id: '>', title: 'is after'},
|
||||
{id: '!>', title: 'is not after'},
|
||||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
{id: '=', title: Ox._('is')},
|
||||
{id: '!=', title: Ox._('is not')},
|
||||
{id: '<', title: Ox._('is before')},
|
||||
{id: '!<', title: Ox._('is not before')},
|
||||
{id: '>', title: Ox._('is after')},
|
||||
{id: '!>', title: Ox._('is not after')},
|
||||
{id: '=,', title: Ox._('is between')},
|
||||
{id: '!=,', title: Ox._('is not between')}
|
||||
],
|
||||
'enum': [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'},
|
||||
{id: '<', title: 'is less than'},
|
||||
{id: '!<', title: 'is not less than'},
|
||||
{id: '>', title: 'is greater than'},
|
||||
{id: '!>', title: 'is not greater than'},
|
||||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
{id: '=', title: Ox._('is')},
|
||||
{id: '!=', title: Ox._('is not')},
|
||||
{id: '<', title: Ox._('is less than')},
|
||||
{id: '!<', title: Ox._('is not less than')},
|
||||
{id: '>', title: Ox._('is greater than')},
|
||||
{id: '!>', title: Ox._('is not greater than')},
|
||||
{id: '=,', title: Ox._('is between')},
|
||||
{id: '!=,', title: Ox._('is not between')}
|
||||
],
|
||||
list: [
|
||||
{id: '==', title: 'is'},
|
||||
{id: '!==', title: 'is not'}
|
||||
{id: '==', title: Ox._('is')},
|
||||
{id: '!==', title: Ox._('is not')}
|
||||
],
|
||||
number: [
|
||||
{id: '=', title: 'is'},
|
||||
{id: '!=', title: 'is not'},
|
||||
{id: '<', title: 'is less than'},
|
||||
{id: '!<', title: 'is not less than'},
|
||||
{id: '>', title: 'is greater than'},
|
||||
{id: '!>', title: 'is not greater than'},
|
||||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
{id: '=', title: Ox._('is')},
|
||||
{id: '!=', title: Ox._('is not')},
|
||||
{id: '<', title: Ox._('is less than')},
|
||||
{id: '!<', title: Ox._('is not less than')},
|
||||
{id: '>', title: Ox._('is greater than')},
|
||||
{id: '!>', title: Ox._('is not greater than')},
|
||||
{id: '=,', title: Ox._('is between')},
|
||||
{id: '!=,', title: Ox._('is not between')}
|
||||
],
|
||||
string: [
|
||||
{id: '==', title: 'is'},
|
||||
{id: '!==', title: 'is not'},
|
||||
{id: '=', title: 'contains'},
|
||||
{id: '!=', title: 'does not contain'},
|
||||
{id: '^', title: 'starts with'},
|
||||
{id: '!^', title: 'does not start with'},
|
||||
{id: '$', title: 'ends with'},
|
||||
{id: '!$', title: 'does not end with'}
|
||||
{id: '==', title: Ox._('is')},
|
||||
{id: '!==', title: Ox._('is not')},
|
||||
{id: '=', title: Ox._('contains')},
|
||||
{id: '!=', title: Ox._('does not contain')},
|
||||
{id: '^', title: Ox._('starts with')},
|
||||
{id: '!^', title: Ox._('does not start with')},
|
||||
{id: '$', title: Ox._('ends with')},
|
||||
{id: '!$', title: Ox._('does not end with')}
|
||||
],
|
||||
text: [
|
||||
{id: '=', title: 'contains'},
|
||||
{id: '!=', title: 'does not contain'}
|
||||
{id: '=', title: Ox._('contains')},
|
||||
{id: '!=', title: Ox._('does not contain')}
|
||||
],
|
||||
year: [
|
||||
{id: '==', title: 'is'},
|
||||
{id: '!==', title: 'is not'},
|
||||
{id: '<', title: 'is before'},
|
||||
{id: '!<', title: 'is not before'},
|
||||
{id: '>', title: 'is after'},
|
||||
{id: '!>', title: 'is not after'},
|
||||
{id: '=,', title: 'is between'},
|
||||
{id: '!=,', title: 'is not between'}
|
||||
{id: '==', title: Ox._('is')},
|
||||
{id: '!==', title: Ox._('is not')},
|
||||
{id: '<', title: Ox._('is before')},
|
||||
{id: '!<', title: Ox._('is not before')},
|
||||
{id: '>', title: Ox._('is after')},
|
||||
{id: '!>', title: Ox._('is not after')},
|
||||
{id: '=,', title: Ox._('is between')},
|
||||
{id: '!=,', title: Ox._('is not between')}
|
||||
]
|
||||
};
|
||||
self.defaultValue = {
|
||||
|
|
@ -124,8 +124,8 @@ Ox.Filter = function(options, self) {
|
|||
year: new Date().getFullYear().toString()
|
||||
};
|
||||
self.operators = [
|
||||
{id: '&', title: 'all'},
|
||||
{id: '|', title: 'any'}
|
||||
{id: '&', title: Ox._('all')},
|
||||
{id: '|', title: Ox._('any')}
|
||||
];
|
||||
|
||||
if (!self.options.query.conditions.length) {
|
||||
|
|
@ -141,7 +141,7 @@ Ox.Filter = function(options, self) {
|
|||
self.$operator = Ox.FormElementGroup({
|
||||
elements: [
|
||||
Ox.Label({
|
||||
title: 'Match',
|
||||
title: Ox._('Match'),
|
||||
overlap: 'right',
|
||||
width: 48
|
||||
}),
|
||||
|
|
@ -157,7 +157,7 @@ Ox.Filter = function(options, self) {
|
|||
}),
|
||||
Ox.Label({
|
||||
overlap: 'left',
|
||||
title: 'of the following conditions',
|
||||
title: Ox._('of the following conditions'),
|
||||
width: 160
|
||||
})
|
||||
],
|
||||
|
|
@ -180,7 +180,7 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
],
|
||||
separators: [
|
||||
{title: 'Save as Smart List', width: 112}
|
||||
{title: Ox._('Save as Smart List'), width: 112}
|
||||
]
|
||||
});
|
||||
|
||||
|
|
@ -197,10 +197,10 @@ Ox.Filter = function(options, self) {
|
|||
}),
|
||||
Ox.Select({
|
||||
items: [
|
||||
{id: 'items', title: 'items'},
|
||||
{id: 'items', title: Ox._('items')},
|
||||
{},
|
||||
{id: 'hours', title: 'hours'},
|
||||
{id: 'days', title: 'days'},
|
||||
{id: 'hours', title: Ox._('hours')},
|
||||
{id: 'days', title: Ox._('days')},
|
||||
{},
|
||||
{id: 'GB', title: 'GB'}
|
||||
],
|
||||
|
|
@ -219,14 +219,14 @@ Ox.Filter = function(options, self) {
|
|||
elements: [
|
||||
Ox.Select({
|
||||
items: [
|
||||
{id: 'ascending', title: 'ascending'},
|
||||
{id: 'descending', title: 'descending'}
|
||||
{id: 'ascending', title: Ox._('ascending')},
|
||||
{id: 'descending', title: Ox._('descending')}
|
||||
],
|
||||
width: 128
|
||||
}),
|
||||
Ox.Label({
|
||||
overlap: 'left',
|
||||
title: 'order',
|
||||
title: Ox._('order'),
|
||||
width: 72
|
||||
})
|
||||
],
|
||||
|
|
@ -235,9 +235,9 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
],
|
||||
separators: [
|
||||
{title: 'Limit to', width: 56},
|
||||
{title: 'sorted by', width: 60}, // fixme: this is odd, should be 64
|
||||
{title: 'in', width: 32}
|
||||
{title: Ox._('Limit to'), width: 56},
|
||||
{title: Ox._('sorted by'), width: 60}, // fixme: this is odd, should be 64
|
||||
{title: Ox._('in'), width: 32}
|
||||
]
|
||||
});
|
||||
|
||||
|
|
@ -258,14 +258,14 @@ Ox.Filter = function(options, self) {
|
|||
elements: [
|
||||
Ox.Select({
|
||||
items: [
|
||||
{id: 'ascending', title: 'ascending'},
|
||||
{id: 'descending', title: 'descending'}
|
||||
{id: 'ascending', title: Ox._('ascending')},
|
||||
{id: 'descending', title: Ox._('descending')}
|
||||
],
|
||||
width: 128
|
||||
}),
|
||||
Ox.Label({
|
||||
overlap: 'left',
|
||||
title: 'order',
|
||||
title: Ox._('order'),
|
||||
width: 72
|
||||
})
|
||||
],
|
||||
|
|
@ -274,9 +274,9 @@ Ox.Filter = function(options, self) {
|
|||
})
|
||||
],
|
||||
separators: [
|
||||
{title: 'View', width: 48},
|
||||
{title: 'sorted by', width: 60},
|
||||
{title: 'in', width: 32}
|
||||
{title: Ox._('View'), width: 48},
|
||||
{title: Ox._('sorted by'), width: 60},
|
||||
{title: Ox._('in'), width: 32}
|
||||
]
|
||||
});
|
||||
|
||||
|
|
@ -453,9 +453,9 @@ Ox.Filter = function(options, self) {
|
|||
Ox.Button({
|
||||
id: 'remove',
|
||||
title: self.options.query.conditions.length == 1 ? 'close' : 'remove',
|
||||
tooltip: self.options.query.conditions.length == 1 ? 'Reset this condition'
|
||||
: isGroup ? 'Remove this group of conditions'
|
||||
: 'Remove this condition',
|
||||
tooltip: self.options.query.conditions.length == 1 ? Ox._('Reset this condition')
|
||||
: isGroup ? Ox._('Remove this group of conditions')
|
||||
: Ox._('Remove this condition'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({margin: '0 4px 0 ' + (isGroup ? '292px' : '8px')}) // fixme: 296 is probably correct, but labels seem to be too wide
|
||||
|
|
@ -483,8 +483,8 @@ Ox.Filter = function(options, self) {
|
|||
}),
|
||||
Ox.Button({
|
||||
id: 'add',
|
||||
title: 'add',
|
||||
tooltip: 'Add a condition',
|
||||
title: Ox._('add'),
|
||||
tooltip: Ox._('Add a condition'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({margin: '0 ' + (subpos == -1 ? '4px' : '0') + ' 0 4px'})
|
||||
|
|
@ -504,8 +504,8 @@ Ox.Filter = function(options, self) {
|
|||
], subpos == -1 ? [
|
||||
Ox.Button({
|
||||
id: 'addgroup',
|
||||
title: 'bracket',
|
||||
tooltip: 'Add a group of conditions',
|
||||
title: Ox._('bracket'),
|
||||
tooltip: Ox._('Add a group of conditions'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({margin: '0 0 0 4px'})
|
||||
|
|
@ -587,7 +587,7 @@ Ox.Filter = function(options, self) {
|
|||
renderInput(condition, 1).options({id: 'end'})
|
||||
],
|
||||
separators: [
|
||||
{title: 'and', width: 32}
|
||||
{title: Ox._('and'), width: 32}
|
||||
]
|
||||
})
|
||||
).bindEvent({
|
||||
|
|
@ -654,7 +654,7 @@ Ox.Filter = function(options, self) {
|
|||
}),
|
||||
Ox.Label({
|
||||
overlap: 'left',
|
||||
title: 'of the following conditions',
|
||||
title: Ox._('of the following conditions'),
|
||||
width: 160
|
||||
})
|
||||
],
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ Ox.FormPanel = function(options, self) {
|
|||
})
|
||||
},
|
||||
id: 'valid',
|
||||
title: 'Valid',
|
||||
title: Ox._('Valid'),
|
||||
visible: true,
|
||||
width: 16
|
||||
},
|
||||
|
|
@ -51,7 +51,7 @@ Ox.FormPanel = function(options, self) {
|
|||
}) + 1) + '. ' + value;
|
||||
},
|
||||
id: 'title',
|
||||
title: 'Title',
|
||||
title: Ox._('Title'),
|
||||
visible: true,
|
||||
width: 240
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,24 +22,24 @@ Ox.InsertHTMLDialog = function(options, self) {
|
|||
? 'textarea' : 'input';
|
||||
|
||||
self.items = [
|
||||
{id: 'img', title: 'Image'},
|
||||
{id: 'a', title: 'Link'},
|
||||
{id: 'li', title: 'List'},
|
||||
{id: 'img', title: Ox._('Image')},
|
||||
{id: 'a', title: Ox._('Link')},
|
||||
{id: 'li', title: Ox._('List')},
|
||||
{},
|
||||
{id: 'blockquote', title: 'Blockquote'},
|
||||
{id: 'h1', title: 'Headline'},
|
||||
{id: 'p', title: 'Paragraph'},
|
||||
{id: 'div', title: 'Right-to-Left'},
|
||||
{id: 'blockquote', title: Ox._('Blockquote')},
|
||||
{id: 'h1', title: Ox._('Headline')},
|
||||
{id: 'p', title: Ox._('Paragraph')},
|
||||
{id: 'div', title: Ox._('Right-to-Left')},
|
||||
{},
|
||||
{id: 'b', title: 'Bold'},
|
||||
{id: 'i', title: 'Italic'},
|
||||
{id: 'code', title: 'Monospace'},
|
||||
{id: 's', title: 'Strike'},
|
||||
{id: 'sub', title: 'Subscript'},
|
||||
{id: 'sup', title: 'Superscript'},
|
||||
{id: 'u', title: 'Underline'},
|
||||
{id: 'b', title: Ox._('Bold')},
|
||||
{id: 'i', title: Ox._('Italic')},
|
||||
{id: 'code', title: Ox._('Monospace')},
|
||||
{id: 's', title: Ox._('Strike')},
|
||||
{id: 'sub', title: Ox._('Subscript')},
|
||||
{id: 'sup', title: Ox._('Superscript')},
|
||||
{id: 'u', title: Ox._('Underline')},
|
||||
{},
|
||||
{id: 'br', title: 'Linebreak'}
|
||||
{id: 'br', title: Ox._('Linebreak')}
|
||||
].map(function(item, i) {
|
||||
var form, format;
|
||||
if (item.id == 'img') {
|
||||
|
|
@ -81,8 +81,8 @@ Ox.InsertHTMLDialog = function(options, self) {
|
|||
Ox.Select({
|
||||
id: 'style',
|
||||
items: [
|
||||
{id: 'ul', title: 'Bullets'},
|
||||
{id: 'ol', title: 'Numbers'}
|
||||
{id: 'ul', title: Ox._('Bullets')},
|
||||
{id: 'ol', title: Ox._('Numbers')}
|
||||
],
|
||||
label: 'Style',
|
||||
labelWidth: 128,
|
||||
|
|
@ -168,7 +168,7 @@ Ox.InsertHTMLDialog = function(options, self) {
|
|||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'cancel',
|
||||
title: 'Cancel',
|
||||
title: Ox._('Cancel'),
|
||||
width: 64
|
||||
})
|
||||
.bindEvent({
|
||||
|
|
@ -178,7 +178,7 @@ Ox.InsertHTMLDialog = function(options, self) {
|
|||
}),
|
||||
Ox.Button({
|
||||
id: 'insert',
|
||||
title: 'Insert',
|
||||
title: Ox._('Insert'),
|
||||
width: 64
|
||||
})
|
||||
.bindEvent({
|
||||
|
|
@ -201,7 +201,7 @@ Ox.InsertHTMLDialog = function(options, self) {
|
|||
content: self.$content,
|
||||
height: 184,
|
||||
keys: {enter: 'insert', escape: 'cancel'},
|
||||
title: 'Insert HTML',
|
||||
title: Ox._('Insert HTML'),
|
||||
width: 416 + Ox.UI.SCROLLBAR_SIZE
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ Ox.Picker = function(options, self) {
|
|||
.appendTo(self.$bar);
|
||||
|
||||
self.$doneButton = Ox.Button({
|
||||
title: 'Done',
|
||||
title: Ox._('Done'),
|
||||
width: 48
|
||||
})
|
||||
.click(hideMenu)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ Ox.PlacePicker = function(options, self) {
|
|||
self.$input = Ox.Input({
|
||||
clear: true,
|
||||
id: self.options.id + 'Input',
|
||||
placeholder: 'Find',
|
||||
placeholder: Ox._('Find'),
|
||||
width: 256
|
||||
})
|
||||
.bindEvent('submit', findPlace)
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ Ox.Spreadsheet = function(options, self) {
|
|||
style: 'square',
|
||||
type: 'image',
|
||||
items: [
|
||||
{id: 'before', title: 'Add column before'},
|
||||
{id: 'after', title: 'Add column after'},
|
||||
{id: 'remove', title: 'Remove this column', disabled: self.columns == 1}
|
||||
{id: 'before', title: Ox._('Add column before')},
|
||||
{id: 'after', title: Ox._('Add column after')},
|
||||
{id: 'remove', title: Ox._('Remove this column'), disabled: self.columns == 1}
|
||||
]
|
||||
})
|
||||
.bindEvent({
|
||||
|
|
@ -166,9 +166,9 @@ Ox.Spreadsheet = function(options, self) {
|
|||
style: 'square',
|
||||
type: 'image',
|
||||
items: [
|
||||
{id: 'before', title: 'Add row above'},
|
||||
{id: 'after', title: 'Add row below'},
|
||||
{id: 'remove', title: 'Remove this row', disabled: self.rows == 1}
|
||||
{id: 'before', title: Ox._('Add row above')},
|
||||
{id: 'after', title: Ox._('Add row below')},
|
||||
{id: 'remove', title: Ox._('Remove this row'), disabled: self.rows == 1}
|
||||
]
|
||||
})
|
||||
.bindEvent({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue