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.

Thanks.

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.

I would suggest gettext.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.