Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named intersections #291

Merged
merged 14 commits into from
Dec 3, 2019
14 changes: 12 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,23 @@ module.exports = function(version) {
var wayName = this.getWayName(language, step, options);

// Decide which instruction string to use
// Destination takes precedence over name
// In order of precedence:
// - exit + destination signage
// - destination signage
// - exit signage
// - junction name
// - road name
// - waypoint name (for arrive maneuver)
// - default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this comment!

var instruction;
if (step.destinations && step.exits && instructionObject.exit_destination) {
instruction = instructionObject.exit_destination;
} else if (step.destinations && instructionObject.destination) {
instruction = instructionObject.destination;
} else if (step.exits && instructionObject.exit) {
instruction = instructionObject.exit;
} else if (step.junction_name && instructionObject.junction_name) {
instruction = instructionObject.junction_name;
} else if (wayName && instructionObject.name) {
instruction = instructionObject.name;
} else if (options.waypointName && instructionObject.named) {
Expand Down Expand Up @@ -230,7 +239,8 @@ module.exports = function(version) {
'modifier': instructions[language][version].constants.modifier[modifier],
'direction': this.directionFromDegree(language, step.maneuver.bearing_after),
'nth': nthWaypoint,
'waypoint_name': options.waypointName
'waypoint_name': options.waypointName,
'junction_name': (step.junction_name || '').split(';')[0]
};

return this.tokenize(language, instruction, replaceTokens, options);
Expand Down
40 changes: 26 additions & 14 deletions languages/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,33 @@
},
"sharp left": {
"default": "انعطف يساراً حاداً",
"name": "انعطف يساراً حاداً لتبقى على {way_name}",
"destination": "انعطف يساراً حاداً نحو {destination}"
"name": "انعطف يساراً حاداً لتبقى على {way_name}",
"destination": "انعطف يساراً حاداً نحو {destination}",
"junction_name": "انعطف يساراً حاداً لتبقى على {junction_name}"
},
"sharp right": {
"default": "انعطف يمينا حاداً ",
"name": "انعطف يميناً حاداً لتبقى على {way_name}",
"destination": "انعطف يميناً حاداً نحو {destination}"
"destination": "انعطف يميناً حاداً نحو {destination}",
"junction_name": "انعطف يميناً حاداً لتبقى على {junction_name}"
},
"slight left": {
"default": "انعطف يساراً قليلاً",
"name": " انعطف يساراً قليلاً لتبقى على {way_name} ",
"destination": "انعطف يساراً قليلاً نحو {destination}"
"name": "انعطف يساراً قليلاً لتبقى على {way_name}",
"destination": "انعطف يساراً قليلاً نحو {destination}",
"junction_name": "انعطف يساراً قليلاً لتبقى على {junction_name}"
},
"slight right": {
"default": "انعطف يميناً قليلاً",
"name": "انعطف يميناً قليلاً لتبقى على {way_name}",
"destination": "انعطف يميناً قليلاً نحو {destination} "
"destination": "انعطف يميناً قليلاً نحو {destination}",
"junction_name": "انعطف يميناً قليلاً نحو {junction_name}"
},
"uturn": {
"default": "انعطف دوراناً عكسياً",
"name": "انعطف دوراناً عكسياً وتابع نحو {way_name}",
"destination": "انعطف دوراناً عكسياً نحو {destination}"
"destination": "انعطف دوراناً عكسياً نحو {destination}",
"junction_name": "انعطف دوراناً عكسياً وتابع نحو {junction_name}"
}
},
"depart": {
Expand All @@ -166,17 +171,20 @@
"default": {
"default": "انعطف {modifier}ا",
"name": "انعطف {modifier}ا على {way_name}",
"destination": "انعطف {modifier}ا نحو {destination}"
"destination": "انعطف {modifier}ا نحو {destination}",
"junction_name": "انعطف {modifier}ا على {junction_name}"
},
"straight": {
"default": "تابع قدماً",
"name": "تابع إلى الأمام على {way_name}",
"destination": "تابع قدماً نحو {destination}"
"destination": "تابع قدماً نحو {destination}",
"junction_name": "تابع إلى الأمام على {junction_name}"
},
"uturn": {
"default": "انعطف دوراناً عكسياً عند نهاية الطريق",
"name": "انعطف دوراناً عكسياً على {way_name} عند نهاية الطريق",
"destination": "انعطف دوراناً عكسياً نحو {destination} عند نهاية الطريق"
"destination": "انعطف دوراناً عكسياً نحو {destination} عند نهاية الطريق",
"junction_name": "انعطف دوراناً عكسياً نحو {junction_name}"
}
},
"fork": {
Expand Down Expand Up @@ -463,22 +471,26 @@
"default": {
"default": "انعطف نحو {modifier}",
"name": "انعطف {modifier} على {way_name}",
"destination": "انعطف {modifier} نحو {destination}"
"destination": "انعطف {modifier} نحو {destination}",
"junction_name": "انعطف {modifier} على {junction_name}"
},
"left": {
"default": "انعطف يسارا",
"name": "اسلك مسار الدوران يسارا على {way_name}",
"destination": "انعطف يسارا نحو {destination}"
"destination": "انعطف يسارا نحو {destination}",
"junction_name": "اسلك مسار الدوران يسارا على {junction_name}"
},
"right": {
"default": "انعطف يمينا",
"name": "اسلك مسار الدوران يمينا على {way_name}",
"destination": "انعطف يمينا نحو {destination}"
"destination": "انعطف يمينا نحو {destination}",
"junction_name": "اسلك مسار الدوران يمينا على {junction_name}"
},
"straight": {
"default": "انطلق قدما",
"name": "انطلق قدما على {way_name}",
"destination": "انطلق قدما نحو {destination}"
"destination": "انطلق قدما نحو {destination}",
"junction_name": "انطلق قدما على {junction_name}"
}
},
"use lane": {
Expand Down
36 changes: 24 additions & 12 deletions languages/translations/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,32 @@
"sharp left": {
"default": "Drej skarpt til venstre",
"name": "Drej skarpt til venstre videre ad {way_name}",
"destination": "Drej skarpt til venstre mod {destination}"
"destination": "Drej skarpt til venstre mod {destination}",
"junction_name": "Drej skarpt til venstre videre ved {junction_name}"
},
"sharp right": {
"default": "Drej skarpt til højre",
"name": "Drej skarpt til højre videre ad {way_name}",
"destination": "Drej skarpt til højre mod {destination}"
"destination": "Drej skarpt til højre mod {destination}",
"junction_name": "Drej skarpt til højre videre ved {junction_name}"
},
"slight left": {
"default": "Drej let til venstre",
"name": "Drej let til venstre videre ad {way_name}",
"destination": "Drej let til venstre mod {destination}"
"destination": "Drej let til venstre mod {destination}",
"junction_name": "Drej let til venstre videre ved {junction_name}"
},
"slight right": {
"default": "Drej let til højre",
"name": "Drej let til højre videre ad {way_name}",
"destination": "Drej let til højre mod {destination}"
"destination": "Drej let til højre mod {destination}",
"junction_name": "Drej let til højre videre ved {junction_name}"
},
"uturn": {
"default": "Foretag en U-vending",
"name": "Foretag en U-vending tilbage ad {way_name}",
"destination": "Foretag en U-vending mod {destination}"
"destination": "Foretag en U-vending mod {destination}",
"junction_name": "Foretag en U-vending tilbage ved {junction_name}"
}
},
"depart": {
Expand All @@ -166,17 +171,20 @@
"default": {
"default": "{modifier:turn}",
"name": "{modifier:turn} ad {way_name}",
"destination": "{modifier:turn} mod {destination}"
"destination": "{modifier:turn} mod {destination}",
"junction_name": "{modifier:turn} ved {junction_name}"
},
"straight": {
"default": "Fortsæt ligeud",
"name": "Fortsæt ligeud ad {way_name}",
"destination": "Fortsæt ligeud mod {destination}"
"destination": "Fortsæt ligeud mod {destination}",
"junction_name": "Fortsæt ligeud ved {junction_name}"
},
"uturn": {
"default": "Foretag en U-vending for enden af vejen",
"name": "Foretag en U-vending ad {way_name} for enden af vejen",
"destination": "Foretag en U-vending mod {destination} for enden af vejen"
"destination": "Foretag en U-vending mod {destination} for enden af vejen",
"junction_name": "Foretag en U-vending ved {junction_name}"
}
},
"fork": {
Expand Down Expand Up @@ -463,22 +471,26 @@
"default": {
"default": "{modifier:turn}",
"name": "{modifier:turn} ad {way_name}",
"destination": "{modifier:turn} mod {destination}"
"destination": "{modifier:turn} mod {destination}",
"junction_name": "{modifier:turn} ved {junction_name}"
},
"left": {
"default": "Drej til venstre",
"name": "Drej til venstre ad {way_name}",
"destination": "Drej til venstre mod {destination}"
"destination": "Drej til venstre mod {destination}",
"junction_name": "Drej til venstre ved {junction_name}"
},
"right": {
"default": "Drej til højre",
"name": "Drej til højre ad {way_name}",
"destination": "Drej til højre mod {destination}"
"destination": "Drej til højre mod {destination}",
"junction_name": "Drej til højre ved {junction_name}"
},
"straight": {
"default": "Kør ligeud",
"name": "Kør ligeud ad {way_name}",
"destination": "Kør ligeud mod {destination}"
"destination": "Kør ligeud mod {destination}",
"junction_name": "Kør ligeud ved {junction_name}"
}
},
"use lane": {
Expand Down
38 changes: 25 additions & 13 deletions languages/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,32 @@
"sharp left": {
"default": "Scharf links",
"name": "Scharf links weiterfahren auf {way_name}",
"destination": "Scharf links Richtung {destination}"
"destination": "Scharf links Richtung {destination}",
"junction_name": "Scharf links weiterfahren an {junction_name}"
},
"sharp right": {
"default": "Scharf rechts",
"name": "Scharf rechts weiterfahren auf {way_name}",
"destination": "Scharf rechts Richtung {destination}"
"destination": "Scharf rechts Richtung {destination}",
"junction_name": "Scharf rechts weiterfahren an {junction_name}"
},
"slight left": {
"default": "Leicht links",
"name": "Leicht links weiter auf {way_name}",
"destination": "Leicht links weiter Richtung {destination}"
"destination": "Leicht links weiter Richtung {destination}",
"junction_name": "Leicht links weiter an {junction_name}"
},
"slight right": {
"default": "Leicht rechts weiter",
"name": "Leicht rechts weiter auf {way_name}",
"destination": "Leicht rechts weiter Richtung {destination}"
"destination": "Leicht rechts weiter Richtung {destination}",
"junction_name": "Leicht rechts weiter an {junction_name}"
},
"uturn": {
"default": "180°-Wendung",
"name": "180°-Wendung auf {way_name}",
"destination": "180°-Wendung Richtung {destination}"
"destination": "180°-Wendung Richtung {destination}",
"junction_name": "180°-Wendung an {junction_name}"
}
},
"depart": {
Expand All @@ -166,24 +171,27 @@
"default": {
"default": "{modifier} abbiegen",
"name": "{modifier} abbiegen auf {way_name}",
"destination": "{modifier} abbiegen Richtung {destination}"
"destination": "{modifier} abbiegen Richtung {destination}",
"junction_name": "{modifier} abbiegen an {junction_name}"
},
"straight": {
"default": "Geradeaus weiterfahren",
"name": "Geradeaus weiterfahren auf {way_name}",
"destination": "Geradeaus weiterfahren Richtung {destination}"
"destination": "Geradeaus weiterfahren Richtung {destination}",
"junction_name": "Geradeaus weiterfahren an {junction_name}"
},
"uturn": {
"default": "180°-Wendung am Ende der Straße",
"name": "180°-Wendung auf {way_name} am Ende der Straße",
"destination": "180°-Wendung Richtung {destination} am Ende der Straße"
"destination": "180°-Wendung Richtung {destination} am Ende der Straße",
"junction_name": "180°-Wendung an {junction_name}"
}
},
"fork": {
"default": {
"default": "{modifier} halten an der Gabelung",
"name": "{modifier} halten an der Gabelung auf {way_name}",
"destination": "{modifier} halten an der Gabelung Richtung {destination}"
"destination": "{modifier} halten an der Gabelung Richtung {destination}"
},
"slight left": {
"default": "Links halten an der Gabelung",
Expand Down Expand Up @@ -493,22 +501,26 @@
"default": {
"default": "{modifier} abbiegen",
"name": "{modifier} abbiegen auf {way_name}",
"destination": "{modifier} abbiegen Richtung {destination}"
"destination": "{modifier} abbiegen Richtung {destination}",
"junction_name": "Make a {modifier} at {junction_name}"
},
"left": {
"default": "Links abbiegen",
"name": "Links abbiegen auf {way_name}",
"destination": "Links abbiegen Richtung {destination}"
"destination": "Links abbiegen Richtung {destination}",
"junction_name": "Links abbiegen an {junction_name}"
},
"right": {
"default": "Rechts abbiegen",
"name": "Rechts abbiegen auf {way_name}",
"destination": "Rechts abbiegen Richtung {destination}"
"destination": "Rechts abbiegen Richtung {destination}",
"junction_name": "Rechts abbiegen an {junction_name}"
},
"straight": {
"default": "Geradeaus weiterfahren",
"name": "Geradeaus weiterfahren auf {way_name}",
"destination": "Geradeaus weiterfahren Richtung {destination}"
"destination": "Geradeaus weiterfahren Richtung {destination}",
"junction_name": "Geradeaus weiterfahren an {junction_name}"
}
},
"use lane": {
Expand Down
Loading