<table><tr><td style="">safaalfulaij 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 #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>

<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 style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>The current code does get the locale/language from Qt anyway. (it calls QLocale::system(), which does respect LANG and LANGUAGE )</p>

<p>It probably would also be a good idea to get a list of languages via QLocale::uiLanguages() instead like that find_translation() function does (that would also support things like LANGUAGE="de:ar"). But that's unrelated to this fix IMHO.</p></blockquote>

<p>Maybe later, I like full concept implementations, but yes, not needed.</p>

<p>This will be enough for the time being. Thanks! :-)</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>