mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-28 00:13:40 +00:00
Set iD.detect().locale to requested locale (closes #2672)
When locale is passed in, we should use that locale in the parts of the code that are using iD.detect().locale: * tag reference * localized name display * map scale * info box The one exception is when iD detects 'en-US' and openstreetmap website tries to pass 'en', leave it as 'en-US'
This commit is contained in:
10
js/id/id.js
10
js/id/id.js
@@ -58,9 +58,15 @@ window.iD = function () {
|
||||
return context;
|
||||
};
|
||||
|
||||
context.locale = function(_, path) {
|
||||
locale = _;
|
||||
context.locale = function(loc, path) {
|
||||
locale = loc;
|
||||
localePath = path;
|
||||
|
||||
// Also set iD.detect().locale (unless we detected 'en-us' and openstreetmap wants 'en')..
|
||||
if (!(loc.toLowerCase() === 'en' && iD.detect().locale.toLowerCase() === 'en-us')) {
|
||||
iD.detect().locale = loc;
|
||||
}
|
||||
|
||||
return context;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
iD.ui.Scale = function(context) {
|
||||
var projection = context.projection,
|
||||
imperial = (iD.detect().locale.toLowerCase() === 'en-us'),
|
||||
maxLength = 180,
|
||||
tickHeight = 8;
|
||||
|
||||
function scaleDefs(loc1, loc2) {
|
||||
var lat = (loc2[1] + loc1[1]) / 2,
|
||||
imperial = (iD.detect().locale.toLowerCase() === 'en-us'),
|
||||
conversion = (imperial ? 3.28084 : 1),
|
||||
dist = iD.geo.lonToMeters(loc2[0] - loc1[0], lat) * conversion,
|
||||
scale = { dist: 0, px: 0, text: '' },
|
||||
|
||||
Reference in New Issue
Block a user