<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/D10759" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Might be an idea indeed to switch to default language instead of system one. Can you tell at which point the system one is estimated, and based on what?</p>

<p>Grepping <a href="https://lxr.kde.org/search?_filestring=&_string=QLocale%3A%3Asystem&_casesensitive=1" class="remarkup-link" target="_blank" rel="noreferrer">QLocale::system on lxr.kde.org</a> there are some hits, those might need some fixing as well then for consistency (via notification to app maintainers to fix themselves carefully)?</p>

<p>Still leaves the race condition between the installed hooks. It would have assumed the static init of the kxmlgui lib is only run after the ones of those using the ECMQmLoader, and the registered hooks would be processed in order of registration. So the switchlanguage one is only run after the qmloader ones.</p>

<p>IIRC all this would be not a problem if we were able tun run the switchlanguage hook before the QApp instance is created. Thus setting the LANGUAGE env var to our desire, and then letting things roll as usual. And it is just that things are delayed because the convenience code to find the UI language setting needs QStandardPaths & Co. set, which only is during the QApp instance creation. Anybody can confirm?</p>

<p>I just see there is also a QEvent::LocaleChange event type. Perhaps there could be some listener on that event, which reinstalls an updated translator instance on a change? First event loop might be too late though, given some UI objects have already been created and most KDE code does not support UI locale change.</p>

<p>If this change goes in, then API dox pf ECMPoQmTools should see some mention of this behaviour (change). So people can rely on it.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10759" rel="noreferrer">https://phabricator.kde.org/D10759</a></div></div><br /><div><strong>To: </strong>aacid, apol, ilic<br /><strong>Cc: </strong>kossebau, apol, Frameworks, Build System, michaelh<br /></div>