I'm experiencing a problem loading a translation file using QTranslator
because it has a locale modifier in it. The code I'm using is,
from PyQt4 import QtCore, QtGui
from locale import getdefaultlocale
locale = getdefaultlocale()
app = QtGui.QApplication(sys.argv)
translator = QtCore.QTranslator(app)
translator.load('/usr/share/my_application/tr/qt_%s.qm' % locale[0])
app.installTranslator(translator)
This code works perfect for just about every locale except ones that contain a modifier (E.G. sr_RS@latin.UTF-8
). In that case, it doesn't load the translation file regardless of what's it's named.
I can't seem to figure out what to name the translation file, or what new code I would need to implement in order to get this code functioning.
Thanks in advance, Josh