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:
Bryan Housel
2019-01-23 09:43:16 -05:00
parent ff6ddfb486
commit 20bcfc5730
5 changed files with 505 additions and 83 deletions

File diff suppressed because it is too large Load Diff

36
dist/locales/en.json vendored
View File

@@ -8418,6 +8418,20 @@
"description": "Improve OpenStreetMap in Indonesia",
"extendedDescription": "Mapping in Indonesia? Have questions, want to connect with the community here? Join us at {Url}. All are welcome!"
},
"osm-iran-aparat": {
"name": "OpenStreetMap Iran Aparat",
"description": "Subscribe to our channel at {url}",
"extendedDescription": "A good resource of videos about anything related to OpenStreetMap. Mainly in Persian."
},
"osm-iran-forum": {
"name": "OpenStreetMap Iran web forum",
"description": "OpenStreetMap Iran web forum",
"extendedDescription": "A web forum for OpenStreetMap users in Iran. Feel free to ask questions and discuss with others!"
},
"osm-iran-telegram": {
"name": "OpenStreetMap Iran Telegram",
"description": "You're welcome to join our Telegram channel at {url}. We also have a supergroup of many OSMers interested in Iran. Find its link in bio of channel."
},
"OSM-japan-facebook": {
"name": "OpenStreetMap Japan Community",
"description": "Mappers and OpenStreetMap users in Japan"
@@ -8434,10 +8448,6 @@
"name": "OpenStreetMap Japan",
"description": "Mappers and OpenStreetMap users in Japan"
},
"OSM-korea-telegram": {
"name": "OSM Korea Telegram Channel",
"description": "Unofficial Channnel for OpenStreetMap contributors, communities and users in Korea to share and discuss."
},
"OSM-MY-facebook": {
"name": "OpenStreetMap Malaysia on Facebook",
"description": "For chat about anything related to OpenStreetMap!"
@@ -8465,6 +8475,14 @@
"description": "Improve OpenStreetMap in Nepal",
"extendedDescription": "Mapping in Nepal? Have questions, want to connect with the community here? Join us at {Url}. All are welcome!"
},
"OSM-Asia-mailinglist": {
"name": "OpenStreetMap Asia Mailinglist",
"description": "Talk-asia is the official Mailinglist for Asian Community"
},
"osm-asia-telegram": {
"name": "OpenStreetMap Asia Telegram",
"description": "Join our family: {url}"
},
"OSM-PH-facebook": {
"name": "OpenStreetMap PH Facebook",
"description": "Welcome to OpenStreetMap Philippines, where we encourage all fellow Filipinos to contribute to the OpenStreetMap project."
@@ -8489,7 +8507,11 @@
"name": "OpenStreetMap RU telegram",
"description": "OpenStreetMap Russia telegram chat"
},
"OSM-LKA-facebook": {
"OSM-south-korea-telegram": {
"name": "OSM South Korea Telegram",
"description": "Unofficial Channnel for OpenStreetMap contributors, communities, and users in South Korea to share and discuss."
},
"OSM-sri-lanka-facebook": {
"name": "OpenStreetMap Sri Lanka",
"description": "Improve OpenStreetMap in Sri Lanka",
"extendedDescription": "Mapping in Sri Lanka? Have questions, want to connect with the community here? Join us at {Url}. All are welcome!"
@@ -8777,6 +8799,10 @@
"name": "OpenStreetMap Norway mailing list",
"description": "Mailing list for mappers and OpenStreetMap users, developers and enthusiasts in Norway"
},
"no-telegram": {
"name": "@OSM_no on Telegram",
"description": "OpenStreetMap Norway Telegram chat"
},
"OSM-PL-facebook-group": {
"name": "OpenStreetMap Poland Facebook group",
"description": "Group for mappers and users of OpenStreetMap in Poland"

View File

@@ -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 });
};

View File

@@ -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();

View File

@@ -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 });
}