def __TranslateMessage__(self): """Translate Messages of the Window""" os_language = i18n.GetLocaleOS() if (os_language[0:2] == 'pt'): _ = i18n.InstallLanguage('pt_BR') elif (os_language[0:2] == 'es'): _ = i18n.InstallLanguage('es') else: _ = i18n.InstallLanguage('en')
def __TranslateMessage__(self): """Translate Messages of the Window""" os_language = i18n.GetLocaleOS() if os_language[0:2] == "pt": _ = i18n.InstallLanguage("pt_BR") elif os_language[0:2] == "es": _ = i18n.InstallLanguage("es") else: _ = i18n.InstallLanguage("en")
def __init__(self, parent): """Initialize combobox bitmap""" # Retrieve locales dictionary dict_locales = i18n.GetLocales() # Retrieve locales names and sort them self.locales = dict_locales.values() self.locales = sorted(self.locales) # Retrieve locales keys (eg: pt_BR for Portuguese(Brazilian)) self.locales_key = [ dict_locales.get_key(value)[0] for value in self.locales ] # Find out OS locale self.os_locale = i18n.GetLocaleOS() try: os_lang = self.os_locale[0:2] except TypeError: os_lang = None # Default selection will be English selection = self.locales_key.index('en') # Create bitmap combo self.bitmapCmb = bitmapCmb = BitmapComboBox(parent, style=wx.CB_READONLY) for key in self.locales_key: # Based on composed flag filename, get bitmap filepath = os.path.join(ICON_DIR, "%s.png" % (key)) bmp = wx.Bitmap(filepath, wx.BITMAP_TYPE_PNG) # Add bitmap and info to Combo bitmapCmb.Append(dict_locales[key], bmp, key) # Set default combo item if available on the list if os_lang and key.startswith(os_lang): selection = self.locales_key.index(key) bitmapCmb.SetSelection(selection)