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
|
|
@ -102,7 +102,7 @@ Ox.MapEditor = function(options, self) {
|
|||
}
|
||||
return names.reverse().join(', ');
|
||||
},
|
||||
title: 'Flag',
|
||||
title: Ox._('Flag'),
|
||||
titleImage: 'flag',
|
||||
tooltip: function(data) {
|
||||
return Ox.toTitleCase(data.geoname || '')
|
||||
|
|
@ -136,7 +136,7 @@ Ox.MapEditor = function(options, self) {
|
|||
},
|
||||
id: 'type',
|
||||
operator: '+',
|
||||
title: 'Type',
|
||||
title: Ox._('Type'),
|
||||
titleImage: 'icon',
|
||||
tooltip: function(data) {
|
||||
return Ox.toTitleCase(data.type || '');
|
||||
|
|
@ -153,7 +153,7 @@ Ox.MapEditor = function(options, self) {
|
|||
id: 'name',
|
||||
operator: '+',
|
||||
removable: false,
|
||||
title: 'Name',
|
||||
title: Ox._('Name'),
|
||||
visible: true,
|
||||
width: 144
|
||||
},
|
||||
|
|
@ -163,7 +163,7 @@ Ox.MapEditor = function(options, self) {
|
|||
},
|
||||
id: 'alternativeNames',
|
||||
operator: '+',
|
||||
title: 'Alternative Names',
|
||||
title: Ox._('Alternative Names'),
|
||||
visible: true,
|
||||
width: 144
|
||||
},
|
||||
|
|
@ -177,7 +177,7 @@ Ox.MapEditor = function(options, self) {
|
|||
}
|
||||
return names.reverse().join(', ');
|
||||
},
|
||||
title: 'Geoname',
|
||||
title: Ox._('Geoname'),
|
||||
visible: false,
|
||||
width: 192
|
||||
},
|
||||
|
|
@ -186,7 +186,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: toFixed,
|
||||
id: 'lat',
|
||||
operator: '+',
|
||||
title: 'Latitude',
|
||||
title: Ox._('Latitude'),
|
||||
visible: true,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -195,7 +195,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: toFixed,
|
||||
id: 'lng',
|
||||
operator: '+',
|
||||
title: 'Longitude',
|
||||
title: Ox._('Longitude'),
|
||||
visible: true,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -204,7 +204,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: toFixed,
|
||||
id: 'south',
|
||||
operator: '+',
|
||||
title: 'South',
|
||||
title: Ox._('South'),
|
||||
visible: false,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -212,7 +212,7 @@ Ox.MapEditor = function(options, self) {
|
|||
align: 'right',
|
||||
id: 'west',
|
||||
operator: '+',
|
||||
title: 'West',
|
||||
title: Ox._('West'),
|
||||
visible: false,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -221,7 +221,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: toFixed,
|
||||
id: 'north',
|
||||
operator: '+',
|
||||
title: 'North',
|
||||
title: Ox._('North'),
|
||||
visible: false,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -230,7 +230,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: toFixed,
|
||||
id: 'east',
|
||||
operator: '+',
|
||||
title: 'East',
|
||||
title: Ox._('East'),
|
||||
visible: false,
|
||||
width: 64
|
||||
},
|
||||
|
|
@ -239,7 +239,7 @@ Ox.MapEditor = function(options, self) {
|
|||
format: {type: 'area', args: []},
|
||||
id: 'area',
|
||||
operator: '-',
|
||||
title: 'Area',
|
||||
title: Ox._('Area'),
|
||||
visible: true,
|
||||
width: 128
|
||||
},
|
||||
|
|
@ -249,7 +249,7 @@ Ox.MapEditor = function(options, self) {
|
|||
},
|
||||
id: 'user',
|
||||
operator: '+',
|
||||
title: 'User',
|
||||
title: Ox._('User'),
|
||||
visible: false,
|
||||
width: 96
|
||||
},
|
||||
|
|
@ -259,7 +259,7 @@ Ox.MapEditor = function(options, self) {
|
|||
},
|
||||
id: 'created',
|
||||
operator: '-',
|
||||
title: 'Date Created',
|
||||
title: Ox._('Date Created'),
|
||||
visible: false,
|
||||
width: 128
|
||||
},
|
||||
|
|
@ -269,7 +269,7 @@ Ox.MapEditor = function(options, self) {
|
|||
},
|
||||
id: 'modified',
|
||||
operator: '-',
|
||||
title: 'Date Modified',
|
||||
title: Ox._('Date Modified'),
|
||||
visible: false,
|
||||
width: 128
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ Ox.MapEditor = function(options, self) {
|
|||
align: 'right',
|
||||
id: 'matches',
|
||||
operator: '-',
|
||||
title: 'Matches',
|
||||
title: Ox._('Matches'),
|
||||
visible: true,
|
||||
width: 64
|
||||
});
|
||||
|
|
@ -292,10 +292,10 @@ Ox.MapEditor = 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: 'geoname', title: 'Find: Geoname'}
|
||||
{id: 'all', title: Ox._('Find: All')},
|
||||
{id: 'name', title: Ox._('Find: Name')},
|
||||
{id: 'alternativeNames', title: Ox._('Find: Alternative Names')},
|
||||
{id: 'geoname', title: Ox._('Find: Geoname')}
|
||||
],
|
||||
overlap: 'right',
|
||||
type: 'image'
|
||||
|
|
@ -433,7 +433,7 @@ Ox.MapEditor = function(options, self) {
|
|||
if (self.options.mode == 'define') {
|
||||
self.$findPlaceButton = Ox.Button({
|
||||
title: 'find',
|
||||
tooltip: 'Find',
|
||||
tooltip: Ox._('Find'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({float: 'left', margin: '4px'})
|
||||
|
|
@ -466,7 +466,7 @@ Ox.MapEditor = function(options, self) {
|
|||
.appendTo(self.$placeTitle);
|
||||
self.$deselectPlaceButton = Ox.Button({
|
||||
title: 'close',
|
||||
tooltip: 'Done',
|
||||
tooltip: Ox._('Done'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({float: 'left', margin: '4px'})
|
||||
|
|
@ -485,13 +485,13 @@ Ox.MapEditor = function(options, self) {
|
|||
items: [].concat([
|
||||
self.$nameInput = Ox.Input({
|
||||
id: 'name',
|
||||
label: 'Name',
|
||||
label: Ox._('Name'),
|
||||
labelWidth: 80,
|
||||
width: 240
|
||||
}),
|
||||
self.$alternativeNamesInput = Ox.ArrayInput({
|
||||
id: 'alternativeNames',
|
||||
label: 'Alternative Names',
|
||||
label: Ox._('Alternative Names'),
|
||||
max: 10,
|
||||
//sort: true,
|
||||
values: [],
|
||||
|
|
@ -499,7 +499,7 @@ Ox.MapEditor = function(options, self) {
|
|||
}),
|
||||
self.$geonameInput = Ox.Input({
|
||||
id: 'geoname',
|
||||
label: 'Geoname',
|
||||
label: Ox._('Geoname'),
|
||||
labelWidth: 80,
|
||||
width: 240
|
||||
}),
|
||||
|
|
@ -509,15 +509,15 @@ Ox.MapEditor = function(options, self) {
|
|||
Ox.Select({
|
||||
id: 'type',
|
||||
items: [
|
||||
{id: 'country', title: 'Country'},
|
||||
{id: 'region', title: 'Region'}, // administative (Kansas) or colloquial (Midwest)
|
||||
{id: 'city', title: 'City'},
|
||||
{id: 'borough', title: 'Borough'},
|
||||
{id: 'street', title: 'Street'}, // streets, squares, bridges, tunnels, ...
|
||||
{id: 'building', title: 'Building'}, // airports, stations, stadiums, military installations, ...
|
||||
{id: 'feature', title: 'Feature'} // continents, islands, rivers, lakes, seas, oceans, mountains...
|
||||
{id: 'country', title: Ox._('Country')},
|
||||
{id: 'region', title: Ox._('Region')}, // administative (Kansas) or colloquial (Midwest)
|
||||
{id: 'city', title: Ox._('City')},
|
||||
{id: 'borough', title: Ox._('Borough')},
|
||||
{id: 'street', title: Ox._('Street')}, // streets, squares, bridges, tunnels, ...
|
||||
{id: 'building', title: Ox._('Building')}, // airports, stations, stadiums, military installations, ...
|
||||
{id: 'feature', title: Ox._('Feature')} // continents, islands, rivers, lakes, seas, oceans, mountains...
|
||||
],
|
||||
label: 'Type',
|
||||
label: Ox._('Type'),
|
||||
labelWidth: 80,
|
||||
width: 240
|
||||
})
|
||||
|
|
@ -531,7 +531,7 @@ Ox.MapEditor = function(options, self) {
|
|||
decimals: 8,
|
||||
disabled: ['lat', 'lng'].indexOf(id) > -1,
|
||||
id: id,
|
||||
label: v,
|
||||
label: Ox._(v),
|
||||
labelWidth: 80,
|
||||
min: -max,
|
||||
max: max,
|
||||
|
|
@ -615,7 +615,7 @@ Ox.MapEditor = function(options, self) {
|
|||
self.$areaKmInput = Ox.Input({
|
||||
disabled: true,
|
||||
id: 'areaKm',
|
||||
label: 'Area',
|
||||
label: Ox._('Area'),
|
||||
labelWidth: 80,
|
||||
textAlign: 'right',
|
||||
width: 240
|
||||
|
|
@ -628,7 +628,7 @@ Ox.MapEditor = function(options, self) {
|
|||
self.$matchesInput = Ox.Input({
|
||||
disabled: true,
|
||||
id: 'matches',
|
||||
label: 'Matches',
|
||||
label: Ox._('Matches'),
|
||||
labelWidth: 80,
|
||||
type: 'int',
|
||||
width: 240
|
||||
|
|
@ -643,13 +643,13 @@ Ox.MapEditor = function(options, self) {
|
|||
});
|
||||
|
||||
self.$addPlaceButton = Ox.Button({
|
||||
title: 'Add Place',
|
||||
title: Ox._('Add Place'),
|
||||
width: 90
|
||||
})
|
||||
.css({float: 'left', margin: '4px'})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
if (this.options('title') == 'Add Place') {
|
||||
if (this.options('title') == Ox._('Add Place')) {
|
||||
addPlace();
|
||||
} else {
|
||||
removePlace();
|
||||
|
|
@ -660,7 +660,7 @@ Ox.MapEditor = function(options, self) {
|
|||
.appendTo(self.$placeStatusbar);
|
||||
|
||||
self.$newPlaceButton = Ox.Button({
|
||||
title: 'New Place',
|
||||
title: Ox._('New Place'),
|
||||
width: 70
|
||||
})
|
||||
.css({float: 'right', margin: '4px'})
|
||||
|
|
@ -673,13 +673,13 @@ Ox.MapEditor = function(options, self) {
|
|||
|
||||
if (self.options.mode == 'define') {
|
||||
self.$definePlaceButton = Ox.Button({
|
||||
title: 'Define Place',
|
||||
title: Ox._('Define Place'),
|
||||
width: 80
|
||||
})
|
||||
.css({float: 'right', margin: '4px 0 4px 0'})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
if (this.options('title') == 'Define Place') {
|
||||
if (this.options('title') == Ox._('Define Place')) {
|
||||
definePlace();
|
||||
} else {
|
||||
clearPlace();
|
||||
|
|
@ -797,10 +797,10 @@ Ox.MapEditor = function(options, self) {
|
|||
selected: [place.id]
|
||||
});
|
||||
self.$map.addPlace(place);
|
||||
self.$addPlaceButton.options({title: 'Remove Place'});
|
||||
self.$addPlaceButton.options({title: Ox._('Remove Place')});
|
||||
//setStatus();
|
||||
} else {
|
||||
self.$addPlaceButton.options({disabled: true, title: 'Adding...'});
|
||||
self.$addPlaceButton.options({disabled: true, title: Ox._('Adding...')});
|
||||
self.options.addPlace(encodeValues(place), function(result) {
|
||||
if (result.status.code == 200) {
|
||||
place.id = result.data.id;
|
||||
|
|
@ -813,18 +813,18 @@ Ox.MapEditor = function(options, self) {
|
|||
).show();
|
||||
self.options.mode == 'define' && self.$definePlaceButton.options({
|
||||
disabled: !result.data.matches,
|
||||
title: 'Clear Place'
|
||||
title: Ox._('Clear Place')
|
||||
}).show();
|
||||
self.$addPlaceButton.options({
|
||||
disabled: false,
|
||||
title: 'Remove Place'
|
||||
title: Ox._('Remove Place')
|
||||
}).show();
|
||||
} else if (result.status.code == 409) {
|
||||
if (result.data.names.indexOf(self.$nameInput.value()) > -1) {
|
||||
self.$nameInput.addClass('OxError');
|
||||
}
|
||||
self.$alternativeNamesInput.setErrors(result.data.names);
|
||||
self.$addPlaceButton.options({disabled: false, title: 'Add Place'});
|
||||
self.$addPlaceButton.options({disabled: false, title: Ox._('Add Place')});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -837,14 +837,14 @@ Ox.MapEditor = function(options, self) {
|
|||
lat: null, lng: null,
|
||||
south: null, west: null, north: null, east: null, area: null
|
||||
};
|
||||
self.$definePlaceButton.options({disabled: true, title: 'Clearing...'});
|
||||
self.$definePlaceButton.options({disabled: true, title: Ox._('Clearing...')});
|
||||
self.options.editPlace(values, function() {
|
||||
self.$map.removePlace();
|
||||
self.$list.reloadList();
|
||||
self.$findPlaceButton.show();
|
||||
self.$placeFlag.hide();
|
||||
hideForm();
|
||||
self.$definePlaceButton.options({disabled: false, title: 'Define Place'})
|
||||
self.$definePlaceButton.options({disabled: false, title: Ox._('Define Place')})
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -861,7 +861,7 @@ Ox.MapEditor = function(options, self) {
|
|||
|
||||
function definePlace() {
|
||||
self.$map.newPlace(); // this will call selectPlace, then editPlace
|
||||
self.$definePlaceButton.options({title: 'Clear Place'});
|
||||
self.$definePlaceButton.options({title: Ox._('Clear Place')});
|
||||
}
|
||||
|
||||
function encodeValues(place) {
|
||||
|
|
@ -912,7 +912,7 @@ Ox.MapEditor = function(options, self) {
|
|||
if (self.options.mode == 'define') {
|
||||
self.$definePlaceButton.options({
|
||||
disabled: !result.data.matches,
|
||||
title: 'Clear Place'
|
||||
title: Ox._('Clear Place')
|
||||
});
|
||||
self.$addPlaceButton.options({
|
||||
disabled: !!result.data.matches
|
||||
|
|
@ -979,12 +979,12 @@ Ox.MapEditor = function(options, self) {
|
|||
self.options.selected = '';
|
||||
self.options.places.splice(index, 1);
|
||||
self.$list.options({items: Ox.clone(self.options.places)});
|
||||
self.$addPlaceButton.options({title: 'Add Place'});
|
||||
self.$addPlaceButton.options({title: Ox._('Add Place')});
|
||||
//setStatus();
|
||||
}
|
||||
// fixme: what is this? both options.removePlace and event removeplace??
|
||||
if (self.isAsync) {
|
||||
self.$addPlaceButton.options({disabled: true, title: 'Removing...'})
|
||||
self.$addPlaceButton.options({disabled: true, title: Ox._('Removing...')})
|
||||
self.options.removePlace({id: self.selectedPlace}, function() {
|
||||
self.options.selected = '';
|
||||
self.$list.options({selected: []}).reloadList(true);
|
||||
|
|
@ -992,7 +992,7 @@ Ox.MapEditor = function(options, self) {
|
|||
self.options.mode == 'define' && self.$definePlaceButton.options({
|
||||
disabled: true
|
||||
});
|
||||
self.$addPlaceButton.options({disabled: false, title: 'Add Place'});
|
||||
self.$addPlaceButton.options({disabled: false, title: Ox._('Add Place')});
|
||||
});
|
||||
}
|
||||
self.$map.removePlace();
|
||||
|
|
@ -1029,7 +1029,7 @@ Ox.MapEditor = function(options, self) {
|
|||
}).show();
|
||||
self.$addPlaceButton.options({
|
||||
disabled: self.options.mode == 'define' && !!place.matches,
|
||||
title: 'Remove Place'
|
||||
title: Ox._('Remove Place')
|
||||
}).show();
|
||||
} else {
|
||||
self.$placeTitle.hide();
|
||||
|
|
@ -1077,7 +1077,7 @@ Ox.MapEditor = function(options, self) {
|
|||
getMatches(place);
|
||||
}
|
||||
self.options.mode == 'define' && self.$definePlaceButton.hide();
|
||||
self.$addPlaceButton.options({disabled: false, title: 'Add Place'}).show();
|
||||
self.$addPlaceButton.options({disabled: false, title: Ox._('Add Place')}).show();
|
||||
} else if (!self.selectedPlace && !self.options.selected) {
|
||||
// deselect result place
|
||||
self.$placeFlag.hide();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue