Hello. Is there a way to load the « builtin » translation, say for qtbase, 
without having to specify a filename ? I expected the QTranslator.load(QLocale, 
…) method to do just that, but alas, I still need to specify that I want to 
load, say, « qtbase_fr ». My problem is that I don’t see any nice way to find 
the filename based on the current locale. QLocale.uiLanguages()[0] is « fr-FR » 
for a French system for example, so right now I’m doing

        path = 
QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
        trans = QtCore.QTranslator(self)
        name = QtCore.QLocale.system().uiLanguages()[0].split('-')[0]
        trans.load('qtbase_%s' % name, path)
        self.installTranslator(trans)

The « split(‘-‘)[0] » part looks like a big code smell to me, but what should I 
do ? I tried a number of variations using both load() methods, to no avail.

Best regards
Jérôme Laheurte

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to