<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/118564/">https://git.reviewboard.kde.org/r/118564/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On June 6th, 2014, 12:21 p.m. BST, <b>John Layt</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/118564/diff/1/?file=279088#file279088line98" style="color: black; font-weight: bold; text-decoration: underline;">src/core/kconfig.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags,</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">98</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">setLocale</span><span class="p">(</span><span class="n">QLocale</span><span class="o"><span class="hl">::</span></span><span class="n"><span class="hl">system</span></span><span class="p">().</span><span class="n"><span class="hl">n</span>ame</span><span class="p">());</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">98</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">setLocale</span><span class="p">(</span><span class="n">QLocale</span><span class="p">().</span><span class="n"><span class="hl">bcp47N</span>ame</span><span class="p">());</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The bcp47Name() is a complicated beast that could add lots of other bits on like script to use, etc. I would stick with name() as it is documented in Qt to always return language_COUNTRY, so "QLocale().name().split('_').at(0)". I'll remember to add the needed languageCode() api for QT 5.4. </pre>
</blockquote>
<p>On June 7th, 2014, 5:33 a.m. BST, <b>Matthew Dawson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Not that this would block, but I was trying to understand this when I saw the RR. I was reading this page: http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s04.html , which would suggest that we should take the full version and search more specifically. Is my reading of this correct?
I was actually wondering if bcp47Name() was correct, as it appears to be similar to Posix. It's just that KConfig doesn't search the file correctly. Am I correct there? Is there a better QLocale function to get something more Posix correct? I'm new to dealing with internationalization, so I apologize for stupid questions.
Regardless, this won't block the patch. I rather have 90% functionality working then 20% that is more "correct".</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I haven't had time to dig further yet, but it did occur to me that just the "de" was wrong, from what I remember of other desktop files from KDE4 we used the full locale code. Your link confirms the standard allows for full POSIX locales in all their variations to work, so we may need a lot more code here (what did the KDE4 code do?). However, that said, the POSIX standard explicitly says locale codes should always have the country included, and if you look at the POSIX locales installed on any modern Linux they all have the country, so when writing we should always be using name(), so the matching read should always be using name(). For example, anything generated within KDE's translation system should be using name() when writing which will have the country included.
The BCP47 name is almost always the wrong format to use, it's mostly useful on Windows, for a start it uses "-" in some places where POSIX uses "_", and more importantly it drops parts of the locale that it considers redundant, i.e. returning "de" rather than "de_DE" as it assumes DE is the default country and so not needed, whereas POSIX always requires the country to be added.
See also https://git.reviewboard.kde.org/r/118584/ where we're incorrectly using bcp47Name() to set the system locale, which may be causing us to write the incomplete locale to the desktop file. I think we need to check the whole code base to confirm the bcp47Name() isn't being used anywhere else incorrectly.
Note that QLocale's name() is not fully POSIX compliant, it never adds encoding or modifiers, but I'm working on that.</pre>
<br />
<p>- John</p>
<br />
<p>On June 6th, 2014, 12:43 p.m. BST, Martin Gräßlin wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for KDE Frameworks and John Layt.</div>
<div>By Martin Gräßlin.</div>
<p style="color: grey;"><i>Updated June 6, 2014, 12:43 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kconfig
</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;">Fix locale-aware reading in KDesktopFile
The underlying KConfig used QLocale::name() for getting the locale
aware part. But this returns "de_DE" while the desktop files store
"de".
In addition it constructs a QLocale object instead of using the
system locale. This has the advantage that the usage of
QLocale::setDafault() gets honored by KConfig.</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;">added unit test failed before. I'm not 100 % sure whether using bcp47Name is correct.</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>autotests/kconfigtest.cpp <span style="color: grey">(2b6de0d7d63df6aee69210aa09418628f0b8110a)</span></li>
<li>autotests/kdesktopfiletest.h <span style="color: grey">(d57351fd6edcefd6a0efd9126e454546cfc63b55)</span></li>
<li>autotests/kdesktopfiletest.cpp <span style="color: grey">(494a43c0fb5808a261b9beb56cdc4afd8580ab21)</span></li>
<li>src/core/kconfig.cpp <span style="color: grey">(ea9746c001e235529a1cdd5865b9e1b5c129b56a)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/118564/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>