def __init__(self, iface): # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = QtCore.QFileInfo(QgsApplication.qgisUserDbFilePath( )).path() + "/python/plugins/bdtravaux" # initialize locale localePath = "" # locale = QtCore.QSettings().value("locale/userLocale").toString()[0:2] (ancienne phrase) #pb : 'unicode' object has no attribute 'toString'. Pb de compatibilité entre 1.8 et 2.0 : le type QVariant (qui utilise ".toString" n'existe plus. Simplement enlever ".toString" (si on voulait transformer en un autre format, inclure type=str ou TYPE=INT... dans la parenthèse => .value("locale/userLocale", type=int) par exemple locale = QtCore.QSettings().value("locale/userLocale")[0:2] if QtCore.QFileInfo(self.plugin_dir).exists(): localePath = self.plugin_dir + "/i18n/bdtravaux_" + locale + ".qm" if QtCore.QFileInfo(localePath).exists(): self.translator = QTranslator() self.translator.load(localePath) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) # Create the dialog (after translation) and keep reference self.dlg = BdTravauxDialog() self.dlg_ope = OperationDialog(iface) self.dlg_prev = PrevuDialog(iface)