komoot / photon

an open source geocoder for openstreetmap data
Apache License 2.0
1.96k stars 284 forks source link

Feature request : latinization of names #697

Open simfr24 opened 2 years ago

simfr24 commented 2 years ago

Would it be possible to return, regardless of the chosen language, the local and latinization of the city name ?

Ex : If I'm searching for with the english tag, I get "Al Ghubaiba", but if I look with the french tag, I get the local version "الغبيبة" which is a bit inconsistent.

Ideally, I would love to have the ability to select several languages in order, so for example : if selecting &lang=fr,en, I would get the french name if available, if not, the english one, and only if none of these are available, the local one.

lostfocus commented 2 years ago

I guess that's because the OSM node doesn't have a french name attached: https://www.openstreetmap.org/node/6584833629#map=19/25.26504/55.28861

simfr24 commented 2 years ago

@lostfocus I perfectly understand that, but would it be possible to have a "if no fr revert to en" ?

otbutz commented 2 years ago

We could transform based on the script of the requested language using icu4j if we don't have a matching tag.


if ("Latn".equals(locale.getScript())) {
    return Transliterator.getInstance("Any-Latin").transform(name);
}