organicmaps / organicmaps

🍃 Organic Maps is a free Android & iOS offline maps app for travelers, tourists, hikers, and cyclists. It uses crowd-sourced OpenStreetMap data and is developed with love by MapsWithMe (MapsMe) founders and our community. No ads, no tracking, no data collection, no crapware. Please donate to support the development!

Home Page:https://organicmaps.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support language-specific navigation instructions that cannot be supported by translations

zogmn opened this issue · comments

commented

In Serbian, navigation instructions are in some aspects more complicated then in English.

First, we use both propositions "into" and "onto" when making turns. So a native Serbian speaker would tell you (in Serbian) "turn right into the street", and "turn right onto the road". (This is because streets usually have buildings, so you walk or drive in between those buildings, while roads usually don't have them, so you drive on the surface.)

Second, we use grammatical cases which means that depending on the street name, the end letters of the word might or might not change. E.g. if the street name is "Alberta Anštajna" native speaker would tell you "turn right into Alberta Anštajna", but if a street name is "Ajnštajnova", then the native speaker would tell you "turn right into Ajnštajnovu". Notice that in a first example, the street name was pronounced without any change, while in second example the last letter was changed (Ajnštajnova -> Ajnštajnovu).

Those specifics make the navigation instructions sound more native to the language, but they cannot, IMO, be implemented just by translations, and string placeholders, that OM now supports. They can only be implemented in code, e.g.:

if (streetName.contains("road") || streetName.contains("highway")) 
    preposition = "onto"
else
    preposition = "into"

Or:

if (streetName.endsWith("ska", "cka", "ova", "eva", "ala", "vna") 
       && isOneWord(streetName)
       && notASpecialCase(streetName))
    streetNameToPronounce = streetName.replaceLastLetterWith("u")
else
    streetNameToPronounce = streetName

Does OM already supports implemenation of language-specific logic, and if not, would it be interested to support it in the future?

My understanding is that custom logic could benefit also languages other then Serbian.

commented

CC: @organicmaps/translations-sr

Thanks for the feedback. I'm aware that efforts have been made to implement logic to difficult languages such as Hungarian.

BTW, I've ping the Serbian Translation team to notice it's empty at the moment if you want to volunteer.

commented

Would love to (as much as my free time lets me).

Hi @zogmn ! Thank you for letting us know and providing sample code.

The similar Hungarian logic is implemented here. If you're able and willing to extend this file and its callers to support Serbian, I'd be very grateful and help with your pull request! Otherwise I might be able to get to this after awhile.

https://github.com/organicmaps/organicmaps/blob/master/routing/turns_tts_text_i18n.cpp

commented

Hi @zyphlar, thanks for the link. I will take a look and get back to you if I have any questions.

@zogmn here's the relevant section in the calling code where we would add if(Serbian) and implement:

if (localeKey == "hu")