Bug 351325

Summary: Placemark localization for (OSM) vector rendering
Product: [Applications] marble Reporter: Dennis Nienhüser <nienhueser>
Component: generalAssignee: marble-bugs
Status: RESOLVED FIXED    
Severity: task Keywords: junior-jobs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://wiki.openstreetmap.org/wiki/Multilingual_names
Latest Commit: Version Fixed In:

Description Dennis Nienhüser 2015-08-15 12:41:10 UTC
In OpenStreetMap names of places are usually denoted in the local language. Variants of a name translated into other languages can be added. In most situations it is desirable to display the name in the local language of the viewer of the map, not the local language of the placemark.

For example, the following placemark exists in Budapest:
name => Magyar Nemzeti Bank
name:de => Ungarische Nationalbank
name:en => Hungarian National Bank
name:es => Banco Nacional de Hungría
name:fr => Banque nationale hongroise

On a device with a hungarian locale (QLocale::system::uiLanguages() reports some 'hu' variant), the placemark should be displayed as "Magyar Nemzeti Bank". A German system should display "Ungarische Nationalbank". For an italian system a proper translation is missing, but it might be preferrable to display the english variant "Hungarian National Bank" instead of the local one.

To implement this, we need to
- determine the language code of the placemark: Which country do the placemark's coordinates belong to, what is its locale?
- come up with a list of acceptable display locales. This can likely be extracted from QLocale::system::uiLanguages(), which already includes a preference order.
- Choose the best (in order of preference) translation alternative and display that

Re-using the example above and an italian device, this might result in
- language code of the placemark: 'hu'
- acceptable display locales: ('it', 'en', 'es')
- mapping: ('it' => N/A, 'en' => 'Hungarian National Bank', 'es' => 'Banco Nacional de Hungría')
- the displayed name would become 'Hungarian National Bank' as the most preferred variant

If no mapping is found (e.g. for a chinese device that only reports ('zh') as acceptable locales), the original name should be chosen.
Comment 1 Dennis Nienhüser 2015-08-15 13:03:07 UTC
To get started, have a look at this patch: https://git.reviewboard.kde.org/r/124744/
Comment 2 Dennis Nienhüser 2016-11-05 09:11:44 UTC
Implemented in GeoDataPlacemark::displayName() now.