This is not necessarily a Python or wxPython related question.

Let's say i have GUI made with wxPython. How does one implement changing language of the GUI(menu names, help strings etc.) in a correct way.


6 Years
Discussion Span
Last Post by richieking

You can call file/help or other standar name in a menu,whatever you want.
Here the standar way.

menubar = wx.MenuBar(wx.MB_DOCKABLE)
file = wx.Menu()
help = wx.Menu()
menubar.Append(file, '&File')
menubar.Append(help, '&Help')

So say that you want other name.

menubar = wx.MenuBar(wx.MB_DOCKABLE)
open_file = wx.Menu()
super_help = wx.Menu()
menubar.Append(open_file, '&open_File')
menubar.Append(super_help, '&super_Help')

What you need is a language directory with your languages files.

So you open the file to read on the fly and use the names to populate where needed in your application.

You must have a wx.choice control listing all your languages and as the user make his/her choice , it triggers event and the method for the even takes care you swapping the languages. Very simple ;)


You need a localization file that stores all the text in an easy to get format. It could be either XML, or you can store it into a dictionary and import the file.


Thanks for the answers.

I assume one also needs to use a file to implement saving and loading other kind of settings and configurations? Or is there an easier way?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.