Nominate our 2022 Qt Champions!

Querying the currently-installed QTranslators, to use QCoreApplication::removeTranslator()?

  • I see in the Qt documentation that translations can be removed from the application with QCoreApplication::removeTranslator(). However, that method takes a QTranslator object representing the translator to be removed, which in our application is not currently persisted beyond the loading phase.

    Is there any way to get a list of the installed QTranslators, in order to remove some/all of them? Or do we need to store every QTranslator object loaded, if we want to be able to later unload any of them?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    From a quick look at QCoreApplication sources, no, there's no API to access the list of active translators.

  • Thanks for the reply, @SGaist , I'd come to the same conclusion but it's good to have confirmation from more-experienced eyes.

    In the end, I just completely reworked the logic for loading translations so that, hopefully, we only load what we need and there's never any need to unload them. (We're not doing Dynamic Translation anyway, the user is prompted to restart the application when they change languages.)

Log in to reply