In the interconnected world that we live in today, it is very important to take internationalization into account when developing an application's interface. There is very little to lose in designing an application that completely supports internationalization right from the beginning, but a whole lot to lose if you don't. This recipe will show how to set up an application to use wxPython's built-in support for interface translations.
Below, we will create a complete sample application that shows how to support
localization in a wxPython application's user interface. The first thing to note is the alias for
wx.GetTranslation
that we use below to wrap all interface strings in the application:
import wx import os # Make a shorter alias _ = wx.GetTranslation
Next, during the creation of our App
object, we create and save a reference to a Locale
object. We then tell the Locale
object where we keep our translation files, so that it knows where to...