diff --git a/data/core.yaml b/data/core.yaml index f9da2999c..cc680cab8 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -25,6 +25,14 @@ en: title: Note description: "Spotted an issue? Let other mappers know." tail: Click on the map to add a note. + add_preset: + title: "Add {feature}" + point: + title: "Add {feature} as a point" + line: + title: "Add {feature} as a line" + area: + title: "Add {feature} as an area" browse: title: Browse description: Pan and zoom the map. diff --git a/dist/locales/en.json b/dist/locales/en.json index b26829b22..a1dee379d 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -31,6 +31,18 @@ "description": "Spotted an issue? Let other mappers know.", "tail": "Click on the map to add a note." }, + "add_preset": { + "title": "Add {feature}", + "point": { + "title": "Add {feature} as a point" + }, + "line": { + "title": "Add {feature} as a line" + }, + "area": { + "title": "Add {feature} as an area" + } + }, "browse": { "title": "Browse", "description": "Pan and zoom the map." diff --git a/modules/ui/modes.js b/modules/ui/modes.js index bb8f71f5e..87c01ebf0 100644 --- a/modules/ui/modes.js +++ b/modules/ui/modes.js @@ -103,12 +103,19 @@ export function uiModes(context) { var markerClass = 'add-favorite add-preset-' + preset.name() .replace(/\s+/g, '_') + '-' + d.geom; //replace spaces with underscores to avoid css interpretation - + var presetName = t('presets.presets.' + preset.id + '.name'); + var relevantMatchingGeometry = preset.geometry.filter(function(geometry) { + return ['point', 'line', 'area'].indexOf(geometry) !== -1; + }); + var tooltipTitleID = 'modes.add_preset.title'; + if (relevantMatchingGeometry.length !== 1) { + tooltipTitleID = 'modes.add_preset.' + d.geom + '.title' + } var favoriteMode = { id: markerClass, button: markerClass, - title: t('presets.presets.' + preset.id + '.name'), - description: [t('operations.add.title'), t('presets.presets.' + preset.id + '.name'), t('geometry.' + d.geom)].join(' '), + title: presetName, + description: t(tooltipTitleID, { feature: presetName }), key: '', icon: icon, preset: preset,