<table><tr><td style="">wbauer 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/D9793" rel="noreferrer">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/D9793#189595" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D9793#189595</a>, <a href="https://phabricator.kde.org/p/safaalfulaij/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@safaalfulaij</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Why is this an issue?<br />
There's no difference really in loading ar/LC_MESSAGES/xxx.qm and LC_MESSAGES/xxx_ar.qm (or something like that), i.e. you would have the same problem if all translations would be in the same folder.</p></blockquote>
<p>Well, we were to simplify this to one call of loadTranslation, but yes, not a big deal.</p></div>
</blockquote>
<p>No.</p>
<p>The issue is that not every locale has a separate translation, so you need fallbacks. (e.g. de_AT -> de)<br />
But it could have one, so just using the general language in any case would be wrong too as you couldn't have different translations for the same general language. (think of British English vs. American English e.g., there is a separate en_GB translation for KDE Frameworks)<br />
That's unrelated to whether the translations are in separate folders or all in one though, the latter wouldn't change anything IMHO.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>The only relevant things I can see is that it replaces all occurences of '-' with '_' (which is necessary only because it gets the languages from QLocale::uiLanguages()), and that it doesn't cut off at the first '_', but creates entries cut off at every one. (i.e. "de_XX_YY" would yield "de_XX_YY", "de_XX" and "de" to try, IIUIC, while the current patch would only try "de_XX_YY" and "de")</p>
<p>I could do something similar, i.e. lookup translations in a while loop and cut off at the right-most '_' if a lookup fails until it succeeds.</p></blockquote>
<p>Well, that would be great for an ideal world. We can live for now and check the locales that KDE is currently translated to, and just adapt to them.</p></blockquote>
<p>It only makes a difference if the locale/language is actually set to something like "ll_XX_YY" (i.e. more than one '_') though, and only if there actually is a "ll_XX" translation.</p>
<p>But I will probably have a look at implementing that tomorrow...</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>Maybe later, I like full concept implementations, but yes, not needed.</p></blockquote>
<p>This is a bugfix for existing code though, not a new implementation. ;-)</p>
<p>But it shouldn't be hard to add (even later), just call QLocale::uiLanguages() instead of QLocale::system() and loop over all strings in the list you get (after replacing '-' with '_').<br />
The rest of the code is still needed (unchanged) and would be inside that loop.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9793" rel="noreferrer">https://phabricator.kde.org/D9793</a></div></div><br /><div><strong>To: </strong>wbauer, Frameworks<br /><strong>Cc: </strong>safaalfulaij, Build System<br /></div>