D8351: API dox: add note about calling setApplicationDomain after QApp creation

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Sat Oct 28 22:29:26 UTC 2017


kossebau added a comment.


  @ilic ping? Can you confirm this is correct and by design?
  
  Motivation is:
  `KLocalizedString::setApplicationDomain()` <https://cgit.kde.org/ki18n.git/tree/src/klocalizedstring.cpp#n1257> triggers the creation of the `KLocalizedStringPrivateStatics` instance, which then also reads the currently set env vars to collect the set locales/languages <https://cgit.kde.org/kxmlgui.git/tree/src/kswitchlanguagedialog_p.cpp#n76>. 
  Now KXMLGUI's language switching support for programs injects the override language via `Q_COREAPP_STARTUP_FUNCTION(initializeLanguages)` (see kswitchlanguagedialog_p.cpp <https://cgit.kde.org/kxmlgui.git/tree/src/kswitchlanguagedialog_p.cpp#n44> lines 44ff) by twisting the `LANGUAGE` env var.
  So for that to work, the `KLocalizedStringPrivateStatics` instance has to be created only _after_ the QCoreApplication constructor is run.
  
  A few programs had the order reversed, due to calling `KLocalizedString::setApplicationDomain()` before QApp creation, resulting in the language switching override being ignored and thus broken.

REPOSITORY
  R249 KI18n

REVISION DETAIL
  https://phabricator.kde.org/D8351

To: kossebau, #frameworks, ilic, ltoscano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171028/a175d651/attachment.html>


More information about the Kde-frameworks-devel mailing list