itinero / routing

The routing core of itinero.
Apache License 2.0
221 stars 69 forks source link

Add new Language for Instructions #185

Closed johny8228 closed 6 years ago

johny8228 commented 6 years ago

I would like to add a new language for routing instructions. I've seen that I need to implement this interface ILanguageReference and this basically consists of a Dictionary. My question is : where can I find the Dictionary with all the keys need it in English so that I can translate?

Thanks, Johnny

xivk commented 6 years ago

The keys depend on the implementation of the profiles. Currently it just returns the exact same string because the profiles are code in English. You can see this here for example:

https://github.com/itinero/routing/blob/develop/src/Itinero/Osm/Vehicles/car.lua#L293

The key in this line:

instruction.text = itinero.format(language_reference.get("Take the {0}th exit at the next roundabout."), "" .. exit)

is this string

"Take the {0}th exit at the next roundabout."

That's what needs translating. I suggest you make a translate dictionary but build a set of regression tests for each update of the profile to make sure everything is translated. If you need it translated and maintained, feel free to submit a pull request.

Also, I know this way of providing translations is far from perfect, any ideas you have for future versions, let us know.

johny8228 commented 6 years ago

@xivk thank you for your answer, much appreciated.

xivk commented 6 years ago

Closing this, it's on the roadmap to improve on this for Itinero 2.0, feel free to reopen if you have any more questions.