Skip to content

Commit d669701

Browse files
feat: add optional language parameter to Valhalla provider (#905)
* feat: add optional language parameter to Valhalla provider * Refactor Valhalla struct to use options for language Removed the language field from the Valhalla struct and updated related methods to use options for language settings. * Formatting fixes * More formatting fixes --------- Co-authored-by: Ian Wagner <ian.wagner@stadiamaps.com>
1 parent 9e91e84 commit d669701

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

common/ferrostar/src/routing_adapters/valhalla.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ pub struct ValhallaHttpRequestGenerator {
302302
endpoint_url: String,
303303
/// The Valhalla costing model to use.
304304
profile: String,
305-
// TODO: Language, units, and other top-level parameters
305+
306306
/// Arbitrary key/value pairs which override the defaults.
307307
///
308308
/// These can contain complex nested structures,
@@ -354,6 +354,14 @@ impl ValhallaHttpRequestGenerator {
354354
options,
355355
}
356356
}
357+
/// Sets the language for routing instructions (e.g., "de", "en-US").
358+
///
359+
/// This is a convenience helper that populates the internal options map.
360+
pub fn with_language(mut self, language: impl Into<String>) -> Self {
361+
self.options
362+
.insert("language".to_string(), serde_json::json!(language.into()));
363+
self
364+
}
357365

358366
/// Creates a new Valhalla request generator given an endpoint URL, a profile name,
359367
/// and options to include in the request JSON.

0 commit comments

Comments
 (0)