Bug 351325 - Placemark localization for (OSM) vector rendering
Summary: Placemark localization for (OSM) vector rendering
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR task
Target Milestone: ---
Assignee: marble-bugs
URL: https://wiki.openstreetmap.org/wiki/M...
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2015-08-15 12:41 UTC by Dennis Nienhüser
Modified: 2016-11-05 09:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.