National language support on windows

Hello,

I'm porting my Linux application which uses gettext to MS Windows and have a
problem. Windows needs some libraries to support gettext (am I right?), but
I could't find any user-friendly installers to be used by users of my
application. I found that PoEdit doesn't use gettext, but uses wxLocale to
get the same result. But it seems that wxLocale is not fully supported by
wxPython (wxLocale::AddCatalogLookupPathPrefix ?). I'm searching for a
solution. On windows, my application's .mo files are installed on it's home
directory, so I need to change the path of these files to search. Is there
any way to do what I want with python + wx on MS Windows? Thanks for ideas.

Martynas Jocius

···

--
There is more vision than meets the eye.
http://mjoc.sig.lt

Does it mean that you have no problems with i18n on both posix and windows
platforms now? If so, could you point me at some python code which does what
we're atlking about, please? I'm trying to understand, how gettext's _() are
combined with wxLocale, if they are. Thanks for help.

Martynas Jocius

···

On Tue, Aug 26, 2003 at 12:38:26AM +0200, Alberto Griggio wrote:

Actually the function is called wxLocale_AddCatalogLookupPathPrefix (note
the underscore), but the functionality is there: I know it because I was
hit by this in the past...

--
There is more vision than meets the eye.
http://mjoc.sig.lt

Thanks! I've just solved the problem by exploring wxPython.wx sources. There
is the way to get your app translated using wx without gettext, a tiny
tutorial for wxPython users like me:

   Cross-platform National Language Support in wxPython without gettext
   module
   -------------------­------------------------------------------------

   The easiest way to learn is to look at the concrete example. This is the
   example of simple do-nothing wxPython application.

   Application directory: APP_DIR
   Default system locale, for example: lt_LT
   Application's specific locale directory: APP_DIR + locale

   Files in APP_DIR (unix file separators):

      myapp.py
      locale/
      locale/lt/
      locale/lt/myapp.mo

   File myapp.mo contains these sample translations:
      "OK" -> "Gerai"
      "Hello" -> "Labas"

   The code:

      from wxPython.wx import *
      import os

      class MyDoNotingApp(wxApp):

         def OnInit(self):

            wxLocale_AddCatalogLookupPathPrefix(os.path.join(APP_DIR, "locale"))
            self.locale = wxLocale()
            self.locale.Init(wxLANGUAGE_DEFAULT)
            self.locale.AddCatalog("myapp")

            # Test it
            print wxGetTranslation("OK")
            
            # If we want a shorter name:
            _ = wxGetTranslation
            print _("Hello")

            return True

      if __name__ == "__main__":
         app = MyDoNothingApp(0)
         app.MainLoop()

   Testing:

      $ python myapp.py
      Gerai
      Labas

   I hope this letter will help someone in the future until wxPython demo
   has a real i18n example.

Martynas Jocius

···

On Tue, Aug 26, 2003 at 12:38:26AM +0200, Alberto Griggio wrote:

Actually the function is called wxLocale_AddCatalogLookupPathPrefix (note
the underscore), but the functionality is there: I know it because I was
hit by this in the past...

--
There is more vision than meets the eye.
http://mjoc.sig.lt

Martynas Jocius wrote:

   I hope this letter will help someone in the future until wxPython demo
   has a real i18n example.

How about creating a sample for the demo and sending it to me? At the least you could put your mini-tutorial in the wxPyWiki.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!