<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/128243/">https://git.reviewboard.kde.org/r/128243/</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 18th, 2016, 11:11 p.m. UTC, <b>Chusslove Illich</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;">a) Right, old code is obviously wrong (sigh).
b) According to Gettext convention, LANGUAGE is a fine-tuning variable and it (each of its colon-separated parts) is to be taken as-is, without the system trying to be smart.</pre>
</blockquote>
<p>On June 20th, 2016, 3:09 p.m. UTC, <b>Friedrich W. H. Kossebau</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">a) possibly stayed undetected as there might be no locales in real world which have both modifier and charset set. Still is better to have the code straight, less confusing for anyone who might come to read it (like me :) ).</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">b) My (recently gained) theoretic knowledge about the LANGUAGE env var is mainly from ABOUT-NLS, and there it says "'LL_CC' combinations can be abbreviated as 'LL' to
denote the language's main dialect.". From which I had guessed that e.g. both "LANGUAGE=ru_RU:foo:bar" and "LANGUAGE=ru:foo:bar" would result in the LOCALEPREFIX/ru/LC_MESSAGES/" catalogs being picked up (at least when there are no ru_RU of course). Being a newbie on this field, I miss real-world experience surely and just can talk from what I understood so far and see on my system.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Now, I have not yet got to understanding the code in the gettext lib, but from testing on commandline "LANGUAGE=ru_RU:de:en" will result in the catalogs from the ru folder being used e.g. for the coreutils tool "ls":</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">LANG=de_DE.UTF-8 LC_MESSAGES= LC_ALL= LANGUAGE=ru_RU.UTF-8:de:en ls --help
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">(yes, even using charset here, to show that even that is dealt with when set, though perhaps just ignored)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Doing the same with a ki18n app does not work:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">LANG=de_DE.UTF-8 LC_MESSAGES= LC_ALL= LANGUAGE=ru_RU.UTF-8:de:en okteta
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">will with the current code not result in russian translations in "ru" folder being used for ki18n-based translations, but the "de_DE" on.
More, other than ki18n, the Qt system locale seems to pick up the LANGUAGE setting and goes fur russian, at least QLocale::system(), as used by kf5 code for picking the language to use with QTranslator, results in russian catalogs ("*_ru.qm") being loaded and used.
Can be seen e.g. in the menu string "Show Toolbar" (in "Settings" menu, from kconfig5_qt.po) or the print dialog, where most string are from Qt lib catalog.
Which results in a language mix in the UI.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Only when using just the language code "ru", matching exactly the folder name with the catalog, this will give me also russian translations for anything based on ki18n:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">LANG=de_DE.UTF-8 LC_MESSAGES= LC_ALL= LANGUAGE=ru:de:en okteta
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">So at least on my openSUSE Tumbleweed system both the gettext lib and the Qt locale code seem to have a different treatment of the LANGUAGE env var than what the current ki18n code does.
No idea/experience if that is a problem in the real world though with real world usage of values for the LANGUAGE var. Just hit this issues during naive/clueless translation handling testing and playing around with all the vars. Still, with my current knowledge I would feel better to align the behaviour of ki18n more with the others.</p></pre>
</blockquote>
</blockquote>
<pre style="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;">Possibly things need even more fixing. So values in the list set for "LANGUAGE" seem to be not only taken as they are but instead are also tried in stripped variants (so "ru" catalogs are taken for "LANGUAGE=ru_RU") from what I see. But that comment from gettext's ABOUT-NLS I cited earlier ("'LL_CC' combinations can be abbreviated as 'LL' to denote the language's main dialect.") might also mean ki18n needs to check for a catalog with the language's main dialect, in case there is none for for just the language itself?</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Question which currently prevents me from understanding more: how to know the language's main dialect? Is that "ll_LL", so the same letters as used for the country as used for the language? (I learned that LANG has to have the country always set in the given code, so it is not a problem there)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">So with "LANGUAGE=ll" if there is no "ll/LC_MESSAGES/foo.mo" would we also need to check for "ll_LL/LC_MESSAGES/foo.mo"?</p></pre>
<br />
<p>- Friedrich W. H.</p>
<br />
<p>On June 18th, 2016, 8:36 p.m. UTC, Friedrich W. H. Kossebau wrote:</p>
<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 KDE Frameworks and Chusslove Illich.</div>
<div>By Friedrich W. H. Kossebau.</div>
<p style="color: grey;"><i>Updated June 18, 2016, 8:36 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
ki18n
</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;">This patch fixes two things:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">a) <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">splitLocale(...)</code> had the wrong order of splitting off modifier and codeset: the old code was first splitting off anything behind "." as charset (which would include the modifier though if present) and only then seeing to split off anything behind "@" as modifier. So with both charset and modifier present this would fail.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">b) The locales listed in "LANGUAGE" would be, other than those in "LC_ALL", "LC_MESSAGES" and "LANG", only added as they are to the list of <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">localeLanguages</code>, without generating their variants. That seems unbalanced to me, as it would mean KCatalog not properly detecting mo files e.g. in "/usr/share/locale/ru/LC_MESSAGES/" subfolder with "LANGUAGE=ru_RU.UTF-8", "LANG=", "LC_ALL=", "LC_MESSAGES=". Or is that on purpose?</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/klocalizedstring.cpp <span style="color: grey">(fc80135)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/128243/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>