<table><tr><td style="">pino added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D14163">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D14163#293198" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D14163#293198</a>, <a href="https://phabricator.kde.org/p/vkrause/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@vkrause</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D14163#293194" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D14163#293194</a>, <a href="https://phabricator.kde.org/p/pino/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@pino</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>I noticed the recent changes in this file, so time to chime in.<br />
 This approach only works if each English text (which happens to be the very first for each country, so that's why <tt style="background: #ebebeb; font-size: 13px;">ISOtoCountry()</tt> "works") is <strong>exactly</strong> the same (including capitalization) as the country name specified in iso-codes. Also considering the history of this file, it is very much likely to miss changes done in the latest years...</p>

<p>IMHO this code is simply beyond any repair -- users ought to use iso-codes for these tasks, and not just the catalogs but also the JSON/XML files for all the mappings.</p>

<p>I have locally a prototype of library that uses only QtCore, QtXml, and KI18n for reading iso-codes data; I can publish it somewhere, and fix these issues once and for all.</p></div>
</blockquote>

<p>You are right, there are definitely more problems in this code.</p>

<p>Replacing the data table currently in use here is next on the list, it's indeed heavily outdated. I'm not sure the iso-codes xml/json files are directly usable for this though, as this code can also map localized country names to ISO codes.</p></div>
</blockquote>

<p><tt style="background: #ebebeb; font-size: 13px;">ISOtoCountry()</tt> IMHO ought to be deprecated altogether, and replaced by a pure iso-codes lookup done elsewhere (e.g. in an external library, as I mentioned). This is definitely possible using iso-codes.</p>

<p>OTOH <tt style="background: #ebebeb; font-size: 13px;">countryToISO()</tt> is a more complex situation, and sadly iso-codes does not help here -- you can lookup English names, but that's about it.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>This change is indeed not perfect in case the spelling doesn't match exactly, but that seems to be the exception. So it's still a low-risk step forward IMHO.</p></blockquote>

<p>There seems to be 20-21 entries of countries that either a) do not exist anymore b) their spelling does not match any of name / common name / official name in iso-codes, which makes 9% of the entries... Not to mention around 26 countries that <tt style="background: #ebebeb; font-size: 13px;">countrytransl.map</tt> does not know about.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R174 PIM: KContacts</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D14163">https://phabricator.kde.org/D14163</a></div></div><br /><div><strong>To: </strong>vkrause, mlaurent, pino<br /><strong>Cc: </strong>pino, kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>