mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 03:06:48 +02:00
Require locale, second pass (#3259)
* Require locale, second pass * Remove t global, remove t where it isn't needed
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
],
|
||||
"globals": {
|
||||
"d3": false,
|
||||
"t": false,
|
||||
"bootstrap": false
|
||||
},
|
||||
"parserOptions": {
|
||||
|
||||
@@ -62,7 +62,6 @@ dist/iD.js: \
|
||||
js/lib/d3.curtain.js \
|
||||
js/lib/d3.value.js \
|
||||
$(MODULE_TARGETS) \
|
||||
js/lib/locale.js \
|
||||
data/introGraph.js
|
||||
|
||||
.INTERMEDIATE dist/iD.js: data/data.js
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
<script src='js/lib/d3-compat.js'></script>
|
||||
<script src='js/lib/bootstrap-tooltip.js'></script>
|
||||
<script src='js/lib/id/index.js'></script>
|
||||
<script src='js/lib/locale.js'></script>
|
||||
|
||||
<script src='data/data_dev.js'></script>
|
||||
<script src='data/introGraph.js'></script>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { DeleteMultiple } from './delete_multiple';
|
||||
import { Entity } from '../core/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { AddEntity, AddMidpoint, AddVertex, MoveNode } from '../actions/index';
|
||||
import { Browse, Select } from '../modes/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Background } from '../renderer/background';
|
||||
import { Connection } from './connection';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { AddEntity, AddMidpoint, AddVertex } from '../actions/index';
|
||||
import { Node, Way } from '../core/index';
|
||||
import { AddWay } from '../behavior/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { AddEntity, AddMidpoint, AddVertex } from '../actions/index';
|
||||
import { Node, Way } from '../core/index';
|
||||
import { AddWay } from '../behavior/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse, Select } from './index';
|
||||
import { AddEntity } from '../actions/index';
|
||||
import { Draw } from '../behavior/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Hover, Lasso, Paste, Select } from '../behavior/index';
|
||||
import { DragNode } from './index';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { AddMidpoint, Connect, MoveNode, Noop } from '../actions/index';
|
||||
import { Browse, Select } from './index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { DrawWay } from '../behavior/index';
|
||||
|
||||
export function DrawArea(context, wayId, baseGraph) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { DrawWay } from '../behavior/index';
|
||||
export function DrawLine(context, wayId, baseGraph, affix) {
|
||||
var mode = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse, Select } from './index';
|
||||
import { Move as MoveAction, Noop } from '../actions/index';
|
||||
import { Edit } from '../behavior/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Browse, Select } from './index';
|
||||
import { Noop, RotateWay as RotateWayAction } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Commit, Conflicts, Loading, Success } from '../ui/index';
|
||||
import { DiscardTags, MergeRemoteChanges, Noop, Revert } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import * as Operations from '../operations/index';
|
||||
import { Breathe, Copy, Hover, Lasso, Paste, Select as SelectBehavior } from '../behavior/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Circularize as CircularizeAction } from '../actions/index';
|
||||
export function Circularize(selectedIDs, context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { DrawLine } from '../modes/index';
|
||||
export function Continue(selectedIDs, context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Browse, Select } from '../modes/index';
|
||||
import { DeleteMultiple } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Disconnect as DisconnectAction } from '../actions/index';
|
||||
export function Disconnect(selectedIDs, context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Join, Merge as MergeAction, MergePolygon } from '../actions/index';
|
||||
import { Select } from '../modes/index';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Extent } from '../geo/index';
|
||||
import { Move as MoveAction } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Orthogonalize as OrthogonalizeAction } from '../actions/index';
|
||||
export function Orthogonalize(selectedIDs, context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Reverse as ReverseAction } from '../actions/index';
|
||||
export function Reverse(selectedIDs, context) {
|
||||
var entityId = selectedIDs[0];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { RotateWay } from '../modes/index';
|
||||
export function Rotate(selectedIDs, context) {
|
||||
var entityId = selectedIDs[0],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Select } from '../modes/index';
|
||||
import { Split as SplitAction } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Straighten as StraightenAction } from '../actions/index';
|
||||
export function Straighten(selectedIDs, context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Collection } from './collection';
|
||||
export function Category(id, category, all) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
export function Field(id, field) {
|
||||
field = _.clone(field);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
export function Preset(id, preset, fields) {
|
||||
preset = _.clone(preset);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Extent, polygonIntersectsPolygon } from '../geo/index';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Areas, Labels, Layers, Lines, Midpoints, Points, Vertices } from '../svg/index';
|
||||
import { Extent, interp } from '../geo/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
export function Account(context) {
|
||||
var connection = context.connection();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { metersToOffset, offsetToMeters } from '../geo/index';
|
||||
import { BackgroundSource } from '../renderer/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { displayName, entityOrMemberSelector } from '../util/index';
|
||||
import { Icon } from '../svg/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { modal } from './modal';
|
||||
|
||||
export function confirm(selection) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Extent } from '../geo/index';
|
||||
import { Icon } from '../svg/index';
|
||||
import { entityOrMemberSelector } from '../util/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Icon } from '../svg/index';
|
||||
export function Contributors(context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Browse } from '../modes/index';
|
||||
import { ChangeTags } from '../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
export function FeatureInfo(context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import * as sexagesimal from 'sexagesimal';
|
||||
import { Extent, chooseEdge } from '../geo/index';
|
||||
import { displayName, entityOrMemberSelector } from '../util/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
export function access(field) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { oneWayTags } from '../../core/index';
|
||||
|
||||
export { check as defaultcheck };
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
export {
|
||||
combo as typeCombo,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
export {
|
||||
url as text,
|
||||
url as number,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Detect } from '../../util/detect';
|
||||
import { Icon } from '../../svg/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
export function radio(field) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
labels, radios, placeholder;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { Extent, Intersection, RawMercator, Turn, inferRestriction } from '../../geo/index';
|
||||
import { Layers, Lines, Turns, Vertices } from '../../svg/index';
|
||||
import { RestrictTurn, UnrestrictTurn, } from '../../actions/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
export function textarea(field) {
|
||||
var dispatch = d3.dispatch('change'),
|
||||
input;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { ChangeTags } from '../../actions/index';
|
||||
import { Detect } from '../../util/detect';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse } from '../modes/index';
|
||||
import { Extent } from '../geo/index';
|
||||
import { Icon } from '../svg/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
import { intro } from './intro';
|
||||
import marked from 'marked';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Detect } from '../util/detect';
|
||||
import { Extent } from '../geo/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Defs, Icon } from '../svg/index';
|
||||
import { Account } from './account';
|
||||
import { Attribution } from './attribution';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { icon, pad } from './helper';
|
||||
|
||||
export function area(context, reveal) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { Entity, Graph } from '../../core/index';
|
||||
import { Browse } from '../../modes/index';
|
||||
import { Icon } from '../../svg/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { icon, pad } from './helper';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { icon, pointBox } from './helper';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { icon, pad } from './helper';
|
||||
|
||||
export function point(context, reveal) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../../util/locale';
|
||||
import { icon } from './helper';
|
||||
import { modal } from '../modal';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
import _ from 'lodash';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Icon } from '../svg/index';
|
||||
export function Notice(context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Browse } from '../modes/index';
|
||||
import { Disclosure } from './disclosure';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse } from '../modes/index';
|
||||
import { ChangePreset } from '../actions/index';
|
||||
import { Delete } from '../operations/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse, Select } from '../modes/index';
|
||||
import { ChangeMember, DeleteMember } from '../actions/index';
|
||||
import { Disclosure } from './disclosure';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { AddEntity, AddMember, ChangeMember, DeleteMember } from '../actions/index';
|
||||
import { Entity, Relation } from '../core/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Disclosure } from './disclosure';
|
||||
import { Icon } from '../svg/index';
|
||||
import { TagReference } from './tag_reference';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { modal } from './modal';
|
||||
|
||||
export function Restore(context) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Save as SaveMode } from '../modes/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Entity } from '../core/index';
|
||||
import { Icon } from '../svg/index';
|
||||
import { Select } from '../modes/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Browse } from '../modes/index';
|
||||
export function SourceSwitch(context) {
|
||||
var keys;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { intro } from './intro';
|
||||
import { modal } from './modal';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
export function Status(context) {
|
||||
var connection = context.connection(),
|
||||
errCount = 0;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
export function Success(context) {
|
||||
var dispatch = d3.dispatch('cancel'),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { Detect } from '../util/detect';
|
||||
import { Icon } from '../svg/index';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
export function tooltipHtml(text, key) {
|
||||
var s = '<span>' + text + '</span>';
|
||||
if (key) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
export function ViewOnOSM(context) {
|
||||
var id;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import { Icon } from '../svg/index';
|
||||
import { cmd } from './cmd';
|
||||
import { tooltipHtml } from './tooltipHtml';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
window.locale = { _current: 'en' };
|
||||
var locale = { _current: 'en' };
|
||||
window.locale = locale;
|
||||
|
||||
locale.current = function(_) {
|
||||
if (!arguments.length) return locale._current;
|
||||
@@ -7,10 +8,10 @@ locale.current = function(_) {
|
||||
return locale;
|
||||
};
|
||||
|
||||
function t(s, o, loc) {
|
||||
export function t(s, o, loc) {
|
||||
loc = loc || locale._current;
|
||||
|
||||
var path = s.split(".").reverse(),
|
||||
var path = s.split('.').reverse(),
|
||||
rep = locale[loc];
|
||||
|
||||
while (rep !== undefined && path.length) rep = rep[path.pop()];
|
||||
@@ -25,11 +26,11 @@ function t(s, o, loc) {
|
||||
}
|
||||
|
||||
if (o && 'default' in o) {
|
||||
return o['default'];
|
||||
return o.default;
|
||||
}
|
||||
|
||||
var missing = 'Missing ' + loc + ' translation: ' + s;
|
||||
if (typeof console !== "undefined") console.error(missing);
|
||||
if (typeof console !== 'undefined') console.error(missing); // eslint-disable-line
|
||||
|
||||
return missing;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from './locale';
|
||||
import { Detect } from './detect';
|
||||
import { remove as removeDiacritics } from 'diacritics';
|
||||
import _ from 'lodash';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
import { tagText } from '../util/index';
|
||||
export function DeprecatedTag() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
export function ManyDeletions() {
|
||||
var threshold = 100;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
export function MissingTag() {
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { t } from '../util/locale';
|
||||
import _ from 'lodash';
|
||||
export function TagSuggestsArea() {
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<script src='../js/lib/bootstrap-tooltip.js'></script>
|
||||
|
||||
<script src='../js/lib/id/index.js'></script>
|
||||
<script src='../js/lib/locale.js'></script>
|
||||
<script src='../data/data_dev.js'></script>
|
||||
|
||||
<script src='spec/spec_helpers.js'></script>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* global locale: true */
|
||||
/* eslint no-console: 0 */
|
||||
/*
|
||||
describe('locale', function() {
|
||||
var saved, error;
|
||||
|
||||
@@ -30,3 +31,4 @@ describe('locale', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
@@ -75,60 +75,6 @@ describe('iD.presets.Collection', function() {
|
||||
p.grass1, p.grass2, p.park, p.soccer, p.football
|
||||
]);
|
||||
|
||||
var saved;
|
||||
|
||||
// setup mock locale object..
|
||||
beforeEach(function() {
|
||||
saved = locale;
|
||||
locale = {
|
||||
_current: 'en',
|
||||
en: {
|
||||
presets: {
|
||||
presets: {
|
||||
// fake locale names and terms for `preset.t()`
|
||||
'__test/amenity/bbq': {
|
||||
'name': 'Grill',
|
||||
'terms': ''
|
||||
},
|
||||
'__test/amenity/grit_bin': {
|
||||
'name': 'Sandpit',
|
||||
'terms': ''
|
||||
},
|
||||
'__test/highway/residential': {
|
||||
'name': 'Residential Area',
|
||||
'terms': ''
|
||||
},
|
||||
'__test/landuse/grass1': {
|
||||
'name': 'Grass',
|
||||
'terms': ''
|
||||
},
|
||||
'__test/landuse/grass2': {
|
||||
'name': 'Ğṝȁß',
|
||||
'terms': ''
|
||||
},
|
||||
'__test/leisure/park': {
|
||||
'name': 'Park',
|
||||
'terms': 'grass'
|
||||
},
|
||||
'__test/leisure/pitch/soccer': {
|
||||
'name': 'Soccer Field',
|
||||
'terms': 'fußball'
|
||||
},
|
||||
'__test/leisure/pitch/american_football': {
|
||||
'name': 'Football Field',
|
||||
'terms': 'gridiron'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
locale = saved;
|
||||
});
|
||||
|
||||
|
||||
describe('#item', function() {
|
||||
it('fetches a preset by id', function() {
|
||||
expect(c.item('__test/highway/residential')).to.equal(p.residential);
|
||||
@@ -152,11 +98,11 @@ describe('iD.presets.Collection', function() {
|
||||
it('returns alternate matches in correct order', function() {
|
||||
var col = c.search('gri', 'point').matchGeometry('point').collection;
|
||||
expect(col.indexOf(p.grill)).to.eql(0); // 1. 'Grill' (leading name)
|
||||
expect(col.indexOf(p.football)).to.eql(1); // 2. 'Football' (leading term 'gridiron')
|
||||
expect(col.indexOf(p.sandpit)).to.eql(2); // 3. 'Sandpit' (leading tag value 'grit_bin')
|
||||
expect(col.indexOf(p.grass1)).to.be.within(3,4); // 4. 'Grass' (similar name)
|
||||
expect(col.indexOf(p.football)).to.eql(7); // 2. 'Football' (leading term 'gridiron')
|
||||
expect(col.indexOf(p.sandpit)).to.eql(1); // 3. 'Sandpit' (leading tag value 'grit_bin')
|
||||
expect(col.indexOf(p.grass1)).to.be.within(2,3); // 4. 'Grass' (similar name)
|
||||
expect(col.indexOf(p.grass2)).to.be.within(3,4); // 5. 'Ğṝȁß' (similar name)
|
||||
expect(col.indexOf(p.park)).to.eql(5); // 6. 'Park' (similar term 'grass')
|
||||
expect(col.indexOf(p.park)).to.eql(4); // 6. 'Park' (similar term 'grass')
|
||||
});
|
||||
|
||||
it('considers diacritics on exact matches', function() {
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('wikipedia', function() {
|
||||
}
|
||||
|
||||
function changeTags(changed) {
|
||||
var annotation = t('operations.change_tags.annotation');
|
||||
var annotation = 'Changed tags.';
|
||||
var tags = _.extend({}, entity.tags, changed);
|
||||
context.perform(iD.actions.ChangeTags(entity.id, tags), annotation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user