Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This file is the equivalent of qmltranslor.h and qnltranslator.cpp mixed
- import sys
- import os
- from PySide2.QtGui import QGuiApplication
- from PySide2.QtQml import QQmlApplicationEngine
- from PySide2.QtCore import Signal, Slot, QTranslator
- from main import *
- # QmlTranslator inherits App in order to access the function app.installTranslator
- # This class is exposed to the qml file
- class QmlTanslator(App):
- def __init__(self, *args):
- App.__init__(self)
- self.m_translator = QTranslator
- # signal emmited when language is changed
- languageChanged = Signal()
- #Slot responsible for the translation
- @Slot(str)
- def setTranslation(self, translation):
- self.m_translator.load(translation)
- app.installTranslator(self.m_translator)
- self.languageChanged.emit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement