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

Providing a translation for the given osm values #5

Open
Haves1001 opened this issue Feb 11, 2015 · 10 comments
Open

Providing a translation for the given osm values #5

Haves1001 opened this issue Feb 11, 2015 · 10 comments

Comments

@Haves1001
Copy link

I did use this plugin to implement a search on my leaflet map. I'm not totally sure if I should post this here or on the "main" photon github page.

As you can see on the following picture I am trying to display the information of the search result in german (and any other language the user wants to). Unfortunately all key which start with "osm_" (http://photon.komoot.de/api/?q=berlin&lang=de) won't be "translated".
image

I guess this is because they come directly from osm? I don't know what is the best approach to translate those values, but I definitely would like to use them in the search result, as the information that the shown result is a city might be essential for the user.
If you see a way how this could be resolved best, I would be glad to help/support with it.

@christophlingg
Copy link
Member

I can give you a hand on the implementation, but I will give @yohanboniface some time to answer, he did all the work on this leaflet plugin. For some weeks we also have a new information at the search results: state. I would also add it. Probably it is quite easy when you are changing it anyway.

@Haves1001
Copy link
Author

So you agree that it would be best to change leaflet.photon and not the output of photon itself?
Maybe it is possible to (re)use localised strings from other projects like iD, as it would be best to provide as many translations as possible.

@christophlingg
Copy link
Member

Hm, that's difficult. On the one hand it would make sense to modify the output of photon, because the other features are translated too, like name, city, country ...

On the other hand these classifications are immutable information similar to the osm_id. Imagine you want to display a house icon if osm_key is house, you don't want to translate osm_keys back to english.

So I would do it in the leaflet plugin.

@Haves1001
Copy link
Author

Ok that is good. That were the exactly same thoughts as I had.

Do you maybe know an already established service for translating these key-value combinations?

@christophlingg
Copy link
Member

ok, this is not making our lives easier: I checked all possible osm key / value pairs that exist in nominatim, there are more than 30 thousands combinations:

https://gist.github.com/christophlingg/c5abfda1019ea0eb35ce

@lonvia
Copy link
Collaborator

lonvia commented Feb 11, 2015

The osm website has a long list of translated descriptions for key/value pairs in their localization files. (e.g English version starts here, other languages are in the same directory).

I'd love to see this part of the localizations move to their own project one day, so that it is easier to use them in other projects (and also to remove myself as a bottleneck in including new key/value pairs to be translated). There is an related issue here: openstreetmap/openstreetmap-website#80

@lonvia
Copy link
Collaborator

lonvia commented Feb 11, 2015

@christophlingg Indeed, but with around 2000 of them most of the data is covered. The long tail are typos and oddities.

@lonvia
Copy link
Collaborator

lonvia commented Feb 11, 2015

To add to that: there are very few keys, so any key/value combinations that are unknown can be mapped to a general description for that key, e.g. amenity=blue_sky is sufficiently described by 'Amenity'.

@yohanboniface
Copy link
Collaborator

@Haves1001 if I get your correctly, I think the best approach is to provide a formatType option, as explained in the README. This should be a function that takes the raw value as input and provide the translated string as output.

I'm not sure this kind of feature as to be in the Leaflet.Photon itself (in the sense that every one will have its own translation needs), as soon as the plugin gives you a way to take control of it.

@Haves1001
Copy link
Author

Mhh this really seems to be harder than expected. And I would agree @yohanboniface that the whole translation thing could be an overkill for the leaflet photon plugin itself.

@lonvia , @christophlingg : Maybe the best approach would be to create some kind of new repository where you would use the localisation files from openstreetmap-website/.../locales to create some kind of library (Javascript, PHP ...)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants