def selectionChanged(self): locale = self["locales"].getCurrent()[self.LIST_LOCALE] if locale in international.getLocaleList(): international.activateLocale(locale, runCallbacks=False) else: international.activateLocale(self.initialLocale, runCallbacks=False) self.updateText()
def keySave(self): config.osd.language.value = self.currentLocale config.osd.language.save() config.misc.locale.value = self.currentLocale language, country = international.splitLocale(self.currentLocale) config.misc.language.value = language config.misc.country.value = country config.misc.locale.save() config.misc.language.save() config.misc.country.save() international.activateLocale(self.currentLocale, runCallbacks=True) self.close()
def run(self, justlocal=False): locale = self["locales"].getCurrent()[self.LIST_LOCALE] if locale != config.osd.language.value: config.osd.language.value = locale config.osd.language.save() if locale != config.misc.locale.value: config.misc.locale.value = locale language, country = international.splitLocale(locale) config.misc.language.value = language config.misc.country.value = country config.misc.locale.save() config.misc.language.save() config.misc.country.save() if justlocal: return international.activateLocale(locale, runCallbacks=True)
def processPackage(self): self.packageTimer.stop() current = self["locales"].getCurrent() locale = current[self.LIST_LOCALE] package = current[self.LIST_PACKAGE] status = current[self.LIST_STATUS] if status == self.PACK_AVAILABLE: retVal, result = international.installLanguagePackages([package]) if retVal: self.session.open(MessageBox, result, type=MessageBox.TYPE_ERROR, timeout=5, title=self.getTitle()) else: international.activateLocale(locale, runCallbacks=False) elif status == self.PACK_INSTALLED: international.activateLocale(self.currentLocale, runCallbacks=False) retVal, result = international.deleteLanguagePackages([package]) if retVal: self.session.open(MessageBox, result, type=MessageBox.TYPE_ERROR, timeout=5, title=self.getTitle()) else: permanent = sorted(international.getPermanentLocales(locale)) permanent = ", ".join(permanent) self.session.openWithCallback( self.processPurge, MessageBox, _("Do you want to purge all locales/languages except %s?") % permanent, default=False) self.packageDoneTimer.start(50)
def activateLanguage(self, language): return international.activateLocale(language)
def keyCancel(self, closeParameters=()): # if self["locales"].isChanged(): # self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), default=False) # else: international.activateLocale(self.initialLocale, runCallbacks=False) self.close(*closeParameters)