mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-01 01:30:20 +02:00
Improve int'l date/time strings on imagery and history tools
(closes #4594)
This commit is contained in:
@@ -2738,7 +2738,7 @@ img.tile {
|
||||
padding: 5px;
|
||||
border-radius: 3px;
|
||||
z-index: 2;
|
||||
margin-left: -50px;
|
||||
margin-left: -70px;
|
||||
margin-top: -20px;
|
||||
|
||||
transform-origin:0 0;
|
||||
@@ -2959,6 +2959,12 @@ img.tile-removing {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.panel-content li span {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.panel-content .button {
|
||||
display: inline-block;
|
||||
background: #7092ff;
|
||||
@@ -2974,11 +2980,11 @@ img.tile-removing {
|
||||
}
|
||||
|
||||
.panel-content-history .links a {
|
||||
margin-left: 10px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
[dir='rtl'] .panel-content-history .links a {
|
||||
margin-left: auto;
|
||||
margin-right: 10px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.panel-content-history .view-history-on-osm {
|
||||
|
||||
@@ -6,13 +6,16 @@ import { geoArea as d3_geoArea } from 'd3-geo';
|
||||
import { t } from '../util/locale';
|
||||
import { geoExtent, geoPolygonIntersectsPolygon } from '../geo';
|
||||
import { jsonpRequest } from '../util/jsonp_request';
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
|
||||
function localeDateString(s) {
|
||||
if (!s) return null;
|
||||
var detected = utilDetect();
|
||||
var options = { day: 'numeric', month: 'short', year: 'numeric' };
|
||||
var d = new Date(s);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleDateString();
|
||||
return d.toLocaleDateString(detected.locale, options);
|
||||
}
|
||||
|
||||
function vintageRange(vintage) {
|
||||
@@ -28,12 +31,12 @@ function vintageRange(vintage) {
|
||||
|
||||
|
||||
export function rendererBackgroundSource(data) {
|
||||
var source = _clone(data),
|
||||
offset = [0, 0],
|
||||
name = source.name,
|
||||
description = source.description,
|
||||
best = !!source.best,
|
||||
template = source.template;
|
||||
var source = _clone(data);
|
||||
var offset = [0, 0];
|
||||
var name = source.name;
|
||||
var description = source.description;
|
||||
var best = !!source.best;
|
||||
var template = source.template;
|
||||
|
||||
source.scaleExtent = data.scaleExtent || [0, 22];
|
||||
source.overzoom = data.overzoom !== false;
|
||||
|
||||
@@ -73,9 +73,15 @@ function maxPageAtZoom(z) {
|
||||
|
||||
function localeTimestamp(s) {
|
||||
if (!s) return null;
|
||||
var detected = utilDetect();
|
||||
var options = {
|
||||
day: 'numeric', month: 'short', year: 'numeric',
|
||||
hour: 'numeric', minute: 'numeric', second: 'numeric',
|
||||
timeZone: 'UTC'
|
||||
};
|
||||
var d = new Date(s);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleString(undefined, { timeZone: 'UTC' });
|
||||
return d.toLocaleString(detected.locale, options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import rbush from 'rbush';
|
||||
import { d3geoTile as d3_geoTile } from '../lib/d3.geo.tile';
|
||||
import { geoExtent } from '../geo';
|
||||
|
||||
import { utilDetect } from '../util/detect';
|
||||
|
||||
import {
|
||||
utilQsString,
|
||||
utilRebind,
|
||||
@@ -150,9 +152,11 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
|
||||
function localeDateString(s) {
|
||||
if (!s) return null;
|
||||
var detected = utilDetect();
|
||||
var options = { day: 'numeric', month: 'short', year: 'numeric' };
|
||||
var d = new Date(s);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
return d.toLocaleDateString();
|
||||
return d.toLocaleDateString(detected.locale, options);
|
||||
}
|
||||
|
||||
var features = data.currentPageItems.map(function(item) {
|
||||
|
||||
@@ -46,7 +46,7 @@ export function uiPanelBackground(context) {
|
||||
.append('li')
|
||||
.attr('class', 'background-info-list-' + k)
|
||||
.classed('hide', !metadata[k])
|
||||
.text(t('info_panels.background.' + k) + ': ')
|
||||
.text(t('info_panels.background.' + k) + ':')
|
||||
.append('span')
|
||||
.attr('class', 'background-info-span-' + k)
|
||||
.text(metadata[k]);
|
||||
|
||||
@@ -2,6 +2,7 @@ import _filter from 'lodash-es/filter';
|
||||
|
||||
import { t } from '../../util/locale';
|
||||
import { svgIcon } from '../../svg';
|
||||
import { utilDetect } from '../../util/detect';
|
||||
|
||||
|
||||
export function uiPanelHistory(context) {
|
||||
@@ -9,11 +10,14 @@ export function uiPanelHistory(context) {
|
||||
|
||||
function displayTimestamp(entity) {
|
||||
if (!entity.timestamp) return t('info_panels.history.unknown');
|
||||
|
||||
var detected = utilDetect();
|
||||
var options = {
|
||||
day: 'numeric', month: 'short', year: 'numeric',
|
||||
hour: 'numeric', minute: 'numeric', second: 'numeric'
|
||||
};
|
||||
var d = new Date(entity.timestamp);
|
||||
if (isNaN(d.getTime())) return t('info_panels.history.unknown');
|
||||
|
||||
return d.toLocaleString();
|
||||
return d.toLocaleString(detected.locale, options);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,20 +117,24 @@ export function uiPanelHistory(context) {
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.history.version') + ': ' + entity.version);
|
||||
.text(t('info_panels.history.version') + ':')
|
||||
.append('span')
|
||||
.text(entity.version);
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.history.last_edit') + ': ' + displayTimestamp(entity));
|
||||
.text(t('info_panels.history.last_edit') + ':')
|
||||
.append('span')
|
||||
.text(displayTimestamp(entity));
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.history.edited_by') + ': ')
|
||||
.text(t('info_panels.history.edited_by') + ':')
|
||||
.call(displayUser, entity);
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.history.changeset') + ': ')
|
||||
.text(t('info_panels.history.changeset') + ':')
|
||||
.call(displayChangeset, entity);
|
||||
|
||||
if (osm) {
|
||||
|
||||
@@ -113,11 +113,11 @@ export function uiPanelMeasurement(context) {
|
||||
|
||||
|
||||
function redraw(selection) {
|
||||
var resolver = context.graph(),
|
||||
selected = _filter(context.selectedIDs(), function(e) { return context.hasEntity(e); }),
|
||||
singular = selected.length === 1 ? selected[0] : null,
|
||||
extent = geoExtent(),
|
||||
entity;
|
||||
var resolver = context.graph();
|
||||
var selected = _filter(context.selectedIDs(), function(e) { return context.hasEntity(e); });
|
||||
var singular = selected.length === 1 ? selected[0] : null;
|
||||
var extent = geoExtent();
|
||||
var entity;
|
||||
|
||||
selection.html('');
|
||||
|
||||
@@ -143,7 +143,9 @@ export function uiPanelMeasurement(context) {
|
||||
if (!singular) {
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.center') + ': ' +
|
||||
.text(t('info_panels.measurement.center') + ':')
|
||||
.append('span')
|
||||
.text(
|
||||
center[1].toFixed(OSM_PRECISION) + ', ' + center[0].toFixed(OSM_PRECISION)
|
||||
);
|
||||
return;
|
||||
@@ -162,23 +164,32 @@ export function uiPanelMeasurement(context) {
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.geometry') + ': ' +
|
||||
(closed ? t('info_panels.measurement.closed') + ' ' : '') + t('geometry.' + geometry) );
|
||||
.text(t('info_panels.measurement.geometry') + ':')
|
||||
.append('span')
|
||||
.text(
|
||||
(closed ? t('info_panels.measurement.closed') + ' ' : '') + t('geometry.' + geometry)
|
||||
);
|
||||
|
||||
if (closed) {
|
||||
var area = steradiansToSqmeters(entity.area(resolver));
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.area') + ': ' + displayArea(area));
|
||||
.text(t('info_panels.measurement.area') + ':')
|
||||
.append('span')
|
||||
.text(displayArea(area));
|
||||
}
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(lengthLabel + ': ' + displayLength(length));
|
||||
.text(lengthLabel + ':')
|
||||
.append('span')
|
||||
.text(displayLength(length));
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.centroid') + ': ' +
|
||||
.text(t('info_panels.measurement.centroid') + ':')
|
||||
.append('span')
|
||||
.text(
|
||||
centroid[1].toFixed(OSM_PRECISION) + ', ' + centroid[0].toFixed(OSM_PRECISION)
|
||||
);
|
||||
|
||||
@@ -201,11 +212,15 @@ export function uiPanelMeasurement(context) {
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(t('info_panels.measurement.geometry') + ': ' + t('geometry.' + geometry));
|
||||
.text(t('info_panels.measurement.geometry') + ':')
|
||||
.append('span')
|
||||
.text(t('geometry.' + geometry));
|
||||
|
||||
list
|
||||
.append('li')
|
||||
.text(centerLabel + ': ' +
|
||||
.text(centerLabel + ':')
|
||||
.append('span')
|
||||
.text(
|
||||
center[1].toFixed(OSM_PRECISION) + ', ' + center[0].toFixed(OSM_PRECISION)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user