Hello.
I need change language wehn I select it, but I don’t know if i am using wx.locale correctly. When select spanish, the interfaz continue in english. Here this source:
import wx
class Frame(wx.Frame):
def init(self, parent, title):
super().init(parent, title= title)
self.Show()
self.panel = wx.Panel(self)
self.message = wx.StaticText(self.panel, -1, wx.GetTranslation(‘hello World’))
self.selectMenu = wx.ComboBox(self.panel, -1, choices= [‘Spanish’, ‘English’], style= wx.CB_READONLY)
self.selectMenu.SetFocus()
self.Bind(wx.EVT_COMBOBOX, self.changeLanguage, self.selectMenu)
self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
self.locale.AddCatalogLookupPathPrefix(‘locale’)
self.locale.AddCatalog(‘ventana’)
self.locale.AddCatalog(‘wxstd’)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.message)
self.sizer.Add(self.selectMenu)
self.panel.SetSizer(self.sizer)
def changeLanguage(self, event):
if self.selectMenu.GetValue() == 'Spanish':
self.locale = wx.Locale(wx.LANGUAGE_SPANISH)
self.Refresh()
else:
self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
self.Refresh()
app = wx.App()
Frame(None, ‘Translator’)
app.MainLoop()