<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/124744/">https://git.reviewboard.kde.org/r/124744/</a>
     </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="12" style="border: 1px gray solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>
   <h1 style="margin: 0; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for Marble.</div>
<div>By Dennis Nienhüser.</div>


<p style="color: grey;"><i>Updated Nov. 5, 2016, 9:11 a.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=351325">351325</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
marble
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">If no mapping is found (e.g. for a chinese device that only reports ('zh') as acceptable locales), the original name should be chosen.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This is a proof-of-concept implementation to localize OSM placemarks in vector rendering. It has a hard-coded preference of German placemark names. The patch is not meant to be committed, but instead meant for discussion and to provide a jump-start for whoever wants to implement <a href="https://bugs.kde.org/show_bug.cgi?id=351325" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">task 351325</a>.</p></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The patch can be tested by opening any .osm file with Marble. Download e.g. <a href="http://nienhueser.de/marble/Budapest.osm" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">Budapest.osm</a> or <a href="http://nienhueser.de/marble/Shanghai.osm" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">Shanghai.osm</a> and open it to see some translated placemarks.</p></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/lib/marble/PlacemarkLayout.cpp <span style="color: grey">(a4a2c40)</span></li>

 <li>src/lib/marble/VisiblePlacemark.cpp <span style="color: grey">(2fdc8ec)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPlacemark.h <span style="color: grey">(ad9f434)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPlacemark.cpp <span style="color: grey">(9edaa84)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/124744/diff/" style="margin-left: 3em;">View Diff</a></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>


 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2015/08/15/52f287fa-481d-4013-b8a8-962eea0a2e7f__marble-budapest-hu.png">Hungarian locale rendering</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2015/08/15/23d5ea78-dc3c-48fb-9410-833e7a8c4fca__marble-budapest-de.png">German locale rendering</a></li>

</ul>




  </td>
 </tr>
</table>



  </div>
 </body>
</html>