Add system translations
Items like dialog box buttons were not localised. This loads the default qt localisation, and also unloads the old localisation on locale change. Still needs to be adjusted for frozen. Addresses Bitmessage#737
This commit is contained in:
parent
7ef94b446d
commit
eb35f35b83
|
@ -69,11 +69,27 @@ def _translate(context, text):
|
|||
return QtGui.QApplication.translate(context, text)
|
||||
|
||||
def change_translation(locale):
|
||||
global qtranslator
|
||||
qtranslator = QtCore.QTranslator()
|
||||
global qmytranslator, qsystranslator
|
||||
try:
|
||||
if not qmytranslator.isEmpty():
|
||||
QtGui.QApplication.removeTranslator(qmytranslator)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if not qsystranslator.isEmpty():
|
||||
QtGui.QApplication.removeTranslator(qsystranslator)
|
||||
except:
|
||||
pass
|
||||
|
||||
qmytranslator = QtCore.QTranslator()
|
||||
translationpath = os.path.join (shared.codePath(), 'translations', 'bitmessage_' + locale)
|
||||
qtranslator.load(translationpath)
|
||||
QtGui.QApplication.installTranslator(qtranslator)
|
||||
qmytranslator.load(translationpath)
|
||||
QtGui.QApplication.installTranslator(qmytranslator)
|
||||
|
||||
qsystranslator = QtCore.QTranslator()
|
||||
translationpath = os.path.join (str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)), 'qt_' + locale)
|
||||
qsystranslator.load(translationpath)
|
||||
QtGui.QApplication.installTranslator(qsystranslator)
|
||||
|
||||
class MyForm(settingsmixin.SMainWindow):
|
||||
|
||||
|
|
Reference in New Issue
Block a user