osm-americana / openstreetmap-americana

A quintessentially American map style
https://americanamap.org
Creative Commons Zero v1.0 Universal
183 stars 59 forks source link

Language picker in other languages #846

Open wmisener opened 1 year ago

wmisener commented 1 year ago

I love the language picker, it probably makes this style already the most easily multilingual OSM style I’ve seen. However, it’s somewhat ironic that it only finds languages if their name is typed in English. Is it technically feasible to search for languages with names other than their English one? By this I mean that typing "Esp" in the search should suggest "Español/Spanish". It might be unfeasible/overwhelming to have every language available at all times, but at least as a start maybe it could retrieve the native name for the language in its own tongue as well as English? So that either "Deutsch" or "German" would pull up German, "Español" or "Spanish" would pull up Spanish, "Nihongo" (or maybe in kanji instead/as well) or "Japanese" for Japanese, etc. Allowing searching on the ISO language codes could further this as well, though it'd be maybe less obvious for a new user.

Screenshots of what I mean:

Screen Shot 2023-03-31 at 12 36 54 PM

Typing "Esp" retrieves only Esperanto, whereas it'd be nice if it suggested "Spanish"/"Español".

Screen Shot 2023-03-31 at 12 37 15 PM

Typing "Deu" suggests nothing, whereas it'd be nice if it suggested "German"/"Deutsch"

nickrsan commented 1 year ago

Allowing searching on the ISO language codes could further this as well, though it'd be maybe less obvious for a new user

I've wanted this as well, or alternatively a way to toggle to a view where I could select from a list. I think the search method is a good default, but it leaves a lot of mystery as to what's available, and sometimes I'm not sure if I'm not typing something correctly or if it's just not available.

claysmalley commented 1 year ago

The names of the languages in the search field are actually in whatever display language you've picked (or browser settings if unspecified). If I put &language=de,en at the end of the URL, my search results are in German:

Screenshot from 2023-03-31 16-01-43

Though I agree that it would be helpful to search for language names in their native forms. Not everyone is going to know all the exonyms for their own language.

wmisener commented 1 year ago

Huh, that's not the behavior I experience, maybe I'm doing something wrong? I have language=es, but results are clearly in English, not Spanish

Screen Shot 2023-03-31 at 1 13 02 PM
claysmalley commented 1 year ago

Ah, it requires refreshing the page. Guess that's another bug.

1ec5 commented 1 year ago

If you changed the language parameter while looking at the page, it hot-swapped in the new language on the map, but the control needs to be updated too.

I agree that we should also include languages by their autonyms and ISO codes in the suggestions.