Why is there no way to obtain a list of translators?
-
QCoreApplication
stores a list of translators (QTranslator
) that have been installed. Why is it not possible to access them?
It would be very convenient.What's the use-case?
-
What's the use-case?
@Christian-Ehrlicher For example, I want to implement logic for loading and removing translators at the user's discretion.
In this case, I would need to declare an additional variable for the list of translators.
Although the same problem could be easily solved ifQCoreApplication
had a methodtranslators()
.It's not a big deal. It's just about doing unnecessary work and overcomplicating the code.
-
@Christian-Ehrlicher For example, I want to implement logic for loading and removing translators at the user's discretion.
In this case, I would need to declare an additional variable for the list of translators.
Although the same problem could be easily solved ifQCoreApplication
had a methodtranslators()
.It's not a big deal. It's just about doing unnecessary work and overcomplicating the code.
-
@Christian-Ehrlicher For example, I want to implement logic for loading and removing translators at the user's discretion.
In this case, I would need to declare an additional variable for the list of translators.
Although the same problem could be easily solved ifQCoreApplication
had a methodtranslators()
.It's not a big deal. It's just about doing unnecessary work and overcomplicating the code.
So you just have to remember your one QTranslator object pointer which you have to delete also by yourself later on since QCoreApplication does not take ownership of it.
-
@pasabanov
I would suggest as @Christian-Ehrlicher says: simply (lack of) big use case + ease of counting it yourself if you really want to. There isn't some deep reason why Qt might expose some method and not another, they just wrote it and it came out like it has. -
So you just have to remember your one QTranslator object pointer which you have to delete also by yourself later on since QCoreApplication does not take ownership of it.
@Christian-Ehrlicher there might be more than one translator installed at a time. So I need to keep the full list of translators.
-
@Christian-Ehrlicher there might be more than one translator installed at a time. So I need to keep the full list of translators.
So you already have to maintain the loaded and unloaded translator instances including some additional stuff by yourself to present it to your user. How should a list of QTranslator instances currently active really help here?
Feel free to provide a patch including a minimal use-case to the qt bug reporting system if you really think this is such a common use-case that it has to be added to Qt.
-
@pasabanov
I would suggest as @Christian-Ehrlicher says: simply (lack of) big use case + ease of counting it yourself if you really want to. There isn't some deep reason why Qt might expose some method and not another, they just wrote it and it came out like it has. -
@JonB so why don't they implement this now? It's so simple yet convenient. And it won't cause any conflicts with previous versions.
@pasabanov As already stated by my fellows: not enough demands for that use case.
Adding new APIs that only a few people make use of also means bloating the interface and code base for all others and it's also more code to maintain.