mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-30 11:49:39 +02:00
Delimit name-suggestion-preset names on en-dash, not hyphen
To avoid conflicts with hyphenated names, or bilingual names with hyphens in them (like used in Brussels)
This commit is contained in:
@@ -135,7 +135,8 @@ export function presetPreset(id, preset, fields, visible, rawPresets) {
|
||||
if (preset.suggestion) {
|
||||
var path = id.split('/');
|
||||
path.pop(); // remove brand name
|
||||
return origName + ' - ' + t('presets.presets.' + path.join('/') + '.name');
|
||||
// NOTE: insert an en-dash, not a hypen (to avoid conflict with fr - nl names in Brussels etc)
|
||||
return origName + ' – ' + t('presets.presets.' + path.join('/') + '.name');
|
||||
}
|
||||
return preset.t('name', { 'default': origName });
|
||||
};
|
||||
|
||||
@@ -151,9 +151,10 @@ export function uiEntityEditor(context) {
|
||||
.preset(_activePreset)
|
||||
);
|
||||
|
||||
// NOTE: split on en-dash, not a hypen (to avoid conflict with hyphenated names)
|
||||
var label = body.select('.label-inner');
|
||||
var nameparts = label.selectAll('.namepart')
|
||||
.data(_activePreset.name().split(' - '), function(d) { return d; });
|
||||
.data(_activePreset.name().split(' – '), function(d) { return d; });
|
||||
|
||||
nameparts.exit()
|
||||
.remove();
|
||||
|
||||
@@ -219,9 +219,12 @@ export function uiFieldLocalized(field, context) {
|
||||
|
||||
|
||||
function cancelBrand() {
|
||||
// user hit escape, remove whatever is after the ' - '
|
||||
// user hit escape, remove whatever is after the last ' – '
|
||||
// NOTE: split/join on en-dash, not a hypen (to avoid conflict with fr - nl names in Brussels etc)
|
||||
var name = utilGetSetValue(input);
|
||||
name = name.split(' - ', 2)[0].trim();
|
||||
var parts = name.split(' – ');
|
||||
parts.pop();
|
||||
name = parts.join(' – ');
|
||||
utilGetSetValue(input, name);
|
||||
dispatch.call('change', this, { name: name });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user