-
- let instText;
- const destinations = "<b>" + step.destinations + "</b>";
- let namedRoad = true;
- let name;
-
- if (step.name && step.ref) {
- name = "<b>" + step.name + " (" + step.ref + ")</b>";
- } else if (step.name) {
- name = "<b>" + step.name + "</b>";
- } else if (step.ref) {
- name = "<b>" + step.ref + "</b>";
- } else {
- name = OSM.i18n.t(instrPrefix + "unnamed");
- namedRoad = false;
- }
-
- if (step.maneuver.type.match(/^exit (rotary|roundabout)$/)) {
- instText = OSM.i18n.t(template, { name: name });
- } else if (step.maneuver.type.match(/^(rotary|roundabout)$/)) {
- if (step.maneuver.exit) {
- if (step.maneuver.exit <= 10) {
- instText = OSM.i18n.t(template + "_with_exit_ordinal", { exit: OSM.i18n.t(instrPrefix + "exit_counts." + numToWord(step.maneuver.exit)), name: name });
- } else {
- instText = OSM.i18n.t(template + "_with_exit", { exit: step.maneuver.exit, name: name });
- }
- } else {
- instText = OSM.i18n.t(template + "_without_exit", { name: name });
- }
- } else if (step.maneuver.type.match(/^(on ramp|off ramp)$/)) {
- const params = {};
- if (step.exits && step.maneuver.type.match(/^(off ramp)$/)) params.exit = step.exits;
- if (step.destinations) params.directions = destinations;
- if (namedRoad) params.directions = name;
- if (Object.keys(params).length > 0) {
- template = template + "_with_" + Object.keys(params).join("_");
- }
- instText = OSM.i18n.t(template, params);
- } else {
- instText = OSM.i18n.t(template + "_without_exit", { name: name });
- }
- return [[step.maneuver.location[1], step.maneuver.location[0]], ICON_MAP[maneuver_id], instText, step.distance, step_geometry];