mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 01:24:05 +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:
@@ -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';
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
var locale = { _current: 'en' };
|
||||
window.locale = locale;
|
||||
|
||||
locale.current = function(_) {
|
||||
if (!arguments.length) return locale._current;
|
||||
if (locale[_] !== undefined) locale._current = _;
|
||||
else if (locale[_.split('-')[0]]) locale._current = _.split('-')[0];
|
||||
return locale;
|
||||
};
|
||||
|
||||
export function t(s, o, loc) {
|
||||
loc = loc || locale._current;
|
||||
|
||||
var path = s.split('.').reverse(),
|
||||
rep = locale[loc];
|
||||
|
||||
while (rep !== undefined && path.length) rep = rep[path.pop()];
|
||||
|
||||
if (rep !== undefined) {
|
||||
if (o) for (var k in o) rep = rep.replace('{' + k + '}', o[k]);
|
||||
return rep;
|
||||
}
|
||||
|
||||
if (loc !== 'en') {
|
||||
return t(s, o, 'en');
|
||||
}
|
||||
|
||||
if (o && 'default' in o) {
|
||||
return o.default;
|
||||
}
|
||||
|
||||
var missing = 'Missing ' + loc + ' translation: ' + s;
|
||||
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() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user