Skip to content

Commit bd9f1a4

Browse files
committed
Add localized_name field
1 parent 1a1a74f commit bd9f1a4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/service/element.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ pub const TAGS: &[&str] = &[
347347
"image",
348348
"payment_provider",
349349
"telegram",
350+
"localized_name",
350351
];
351352

352353
pub fn generate_tags(
@@ -379,6 +380,19 @@ pub fn generate_tags(
379380
"name" => {
380381
res.insert("name".into(), element.name(lang).into());
381382
}
383+
"localized_name" => {
384+
let mut localized = Map::new();
385+
for (key, value) in osm_tags {
386+
if let Some(lang_code) = key.strip_prefix("name:") {
387+
if lang_code.len() == 2 && value.is_string() {
388+
localized.insert(lang_code.to_string(), value.clone());
389+
}
390+
}
391+
}
392+
if !localized.is_empty() {
393+
res.insert("localized_name".into(), Value::Object(localized));
394+
}
395+
}
382396
"opening_hours" => {
383397
if let Some(opening_hours) = element.opening_hours() {
384398
res.insert("opening_hours".to_string(), opening_hours.into());

0 commit comments

Comments
 (0)