<table><tr><td style="">kossebau 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/D8351" 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/D8351#161562" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">D8351#161562</a>, <a href="https://phabricator.kde.org/p/ilic/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@ilic</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>Well... it's a tough situation. It is not by design that <tt style="background: #ebebeb; font-size: 13px;">i18n</tt> calls should in any way depend on creation of <tt style="background: #ebebeb; font-size: 13px;">QApplication</tt>, and also any library may place an <tt style="background: #ebebeb; font-size: 13px;">i18n</tt> call before the main program creates <tt style="background: #ebebeb; font-size: 13px;">QApplication</tt>. The only solution I see is that environment is rechecked at every <tt style="background: #ebebeb; font-size: 13px;">i18n</tt> call. This would be easy to do (just replacing every <tt style="background: #ebebeb; font-size: 13px;">s->languages</tt> with a newly implemented <tt style="background: #ebebeb; font-size: 13px;">s->getLanguages()</tt>), but I've no idea what would be the performance hit of that.</p></div>
</blockquote>

<p>Thanks for reply, <a href="https://phabricator.kde.org/p/ilic/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@ilic</a>, sorry for not having picked up immediately, as I agree it's tough and I set the topic aside a little to have some thoughts develop in the back of my mind.</p>

<p>One problem that i see with rechecking the environment at every i18n call is that this potentially could result in inconsistent UI. Because the average applications using KI18n is not written to support switching UI localization on the fly. Incl. KXMLGUI's language switching support, which only injects its settings at a roughly defined point in time, as part of the post-handlers of the Q*App instance creation.</p>

<p>So I would agree with <a href="https://phabricator.kde.org/p/dfaure/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@dfaure</a> that for the current KI18n usage (which is somewhat coupled with KXMLGUI's language switching support) we should just stick formally to what technically is needed right now: only doing UI locale-based things after the Q*App instance is created and thus after everything related to localization is setup and prepared (and will stay to the end of the Q*App instance lifetime.</p>

<p>So would push this change upcoming WE, Feb 10/11, finally, unless someone objects.</p>

<p>((In time for Qt6/KF6 we should perhaps revisit this and hopefully have some people work on adding proper infrastructure and usage patterns to allow such switching UI localization on the fly. It's pretty sad that Web apps, which are younger, are better here))</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R249 KI18n</div></div></div><br /><div><strong>BRANCH</strong><div><div>addNoteAboutCallingSetAppDomainAfterQApp</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8351" rel="noreferrer">https://phabricator.kde.org/D8351</a></div></div><br /><div><strong>To: </strong>kossebau, Frameworks, ilic, ltoscano, dfaure<br /><strong>Cc: </strong>dfaure, michaelh, ngraham<br /></div>