|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Re: how to localize a common dialog boxOn Thu, Jul 10, 2008 at 02:45:57PM +0300, Public cai wrote:
> does anybody know how to display a common dialog box such as > wxDirDialog with its strings translated to the language used by the > code calling this dialog box (in this case, German)? I could translate > the message given as parameter to wxDirDialog constructor. Also, the > title could be easily changed by using wxDialog::SetTitle(), but the > name of the buttons, how could I also translate them?... You need to activate the locale system. "import locale" and wx.Locale are your friend. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
Re: Re: how to localize a common dialog boxCristinia,
Public cai wrote: > Hi list, > > does anybody know how to display a common dialog box such as > wxDirDialog with its strings translated to the language used by the > code calling this dialog box (in this case, German)? I could translate > the message given as parameter to wxDirDialog constructor. Also, the > title could be easily changed by using wxDialog::SetTitle(), but the > name of the buttons, how could I also translate them?... > Have a look at the I18N demo in the wxPython demo and at the following wiki: http://wiki.wxpython.org/Internationalization http://wiki.wxpython.org/ValidI18nCodes http://wiki.wxpython.org/XRCAndI18N Note that you can use gettext and local or wx.GetTranslation and wx.Locale, you should use the later if you want wxPython standard strings to be translated and when you distribute your application you should not forget to include the appropriate language.mo files from the wxPython version you are using. Werner _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
Re: Re: how to localize a common dialog boxOn Thu, Jul 10, 2008 at 02:42:41PM +0200, Werner F. Bruhin wrote:
> Note that you can use gettext and local or wx.GetTranslation and > wx.Locale, you should use the later if you want wxPython standard > strings to be translated Note that this is NOT a requirement for wxPython-internal strings (such as stock button labels) to be translated. BOTH ways work. All one needs to make sure is that the normal Python library locale/gettext modules are imported and initialized *before* wxPython is imported. But that would be Good Practice anyway. The reason being that, apparently, during its startup wxPython detects the currently activated system locale and adjusts itself to that. So, if the Python library module locale.setlocale(locale.LC_ALL) was called appropriately, wxPython will automatically be in the right locale, too. This is perfectly sane from a software engineering point of view as wxPython is a layer on top of Python (and other things) so as long as Python did the right thing early enough wxPython should, too (and it does). > and when you distribute your application you > should not forget to include the appropriate language.mo files from the > wxPython version you are using. That advice is prudent but only applies on Windows. On Linux and/or Mac make sure to have the package manager install any needed i18n dependancy packages. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
Re: Re: how to localize a common dialog boxKarsten,
Karsten Hilbert wrote: > On Thu, Jul 10, 2008 at 02:42:41PM +0200, Werner F. Bruhin wrote: > > >> Note that you can use gettext and local or wx.GetTranslation and >> wx.Locale, you should use the later if you want wxPython standard >> strings to be translated >> > > Note that this is NOT a requirement for wxPython-internal > strings (such as stock button labels) to be translated. BOTH > ways work. All one needs to make sure is that the normal > Python library locale/gettext modules are imported and > initialized *before* wxPython is imported. But that would be > Good Practice anyway. > was enough to get wxPython play nicely with locale/gettext. Looking at the wiki pages I noticed that some are a bit dated, i.e. still use the old wxPython namespace. Will see if in the next few weeks I get around to update some of that, at that time will add this pointer too - unless someone else is faster then me :-) . Werner _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
Re: Re: how to localize a common dialog boxOn Thu, Jul 10, 2008 at 03:35:02PM +0200, Werner F. Bruhin wrote:
> Thanks for putting me right, You were not entirely wrong either ;-) Just wanted to clarify a bit more. > I wasn't aware of the fact that the order > was enough to get wxPython play nicely with locale/gettext. At least that's what I observe with GNUmed on Linux/Windows/MacOSX. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
|
|
|
Re: Re: how to localize a common dialog boxOn Fri, Jul 11, 2008 at 12:42:20PM +0300, Public cai wrote:
> Firstly, my code is C++ code and it's using wxWidgets, not wxPython. I > asked on this list because it seemed to me that I get the answer > quicker. What help is a quick answer that doesn't apply ? > > Note that you can use gettext and local or wx.GetTranslation and wx.Locale, you should use the later if you want wxPython standard strings to be translated > >> Note that this is NOT a requirement for wxPython-internal strings (such as stock button labels) to be translated. BOTH ways work. All one needs to make sure is that the normal Python library locale/gettext modules are imported and initialized *before* wxPython is imported. > > Considering that I'm using wxWidgets and not wxPython, do you know > what I should do to accomplish this? You'll have to do the C++ equivalent of what I suggested doing with Python. Now, that doesn't help you much, I know. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
|
|
|
Re: Re: how to localize a common dialog boxOn Sat, Jul 12, 2008 at 08:27:41AM +0300, Public cai wrote:
> >> Firstly, my code is C++ code and it's using wxWidgets, not wxPython. I asked on this list because it seemed to me that I get the answer quicker. > >What help is a quick answer that doesn't apply ? > > Well, for most questions I asked on this list, the answers applied > both to wxPython as to wxWidgets. Now, that's good news. > I continued studying the problem and found out that for Windows, > - wxDirDialog actually calls SHBrowseForFolder() > - SHBrowseForFolder() is a Windows Shell API function > - seems that the Windows Shell API functions are not localized and > follow the language setting of Windows, Your analysis seems correct. > meaning that if the user has a > German Windows installation (for example), she will see the common > dialogs translated to German. Verstehe. > So I guess I shouldn't bother my head with common dialog localization anymore... Scheinbar hat Microsoft für Dich entschieden. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
|
|
|
Re: Re: how to localize a common dialog boxOn Sat, Jul 12, 2008 at 06:47:34PM +0300, Public cai wrote:
> >> So I guess I shouldn't bother my head with common dialog localization anymore... > >Scheinbar hat Microsoft für Dich entschieden. > > ... meaning "Apparently Microsoft decided for you" (Babelfish > translation). So it seems, yes, for all of us Windows users. Oops, from your name and user base methought you spake German. Sorry, Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
|
|
Re: Re: how to localize a common dialog boxPublic cai wrote:
> > I continued studying the problem and found out that for Windows, > - wxDirDialog actually calls SHBrowseForFolder() > - SHBrowseForFolder() is a Windows Shell API function > - seems that the Windows Shell API functions are not localized and > follow the language setting of Windows, meaning that if the user has a > German Windows installation (for example), she will see the common > dialogs translated to German. Also, this means that even when she uses > an English version of our program, she will still see the common > dialogs translated to German if she has a German Windows installation > (see: http://forums.msdn.microsoft.com/en/netfxbcl/thread/40fae6c6-1afc-4a4d-8638-88cdf69c5ee6/) > > The Windows on my machine is English, I always see these common > dialogs in English (even when running a German version of our program) You are correct. -- Robin Dunn Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython! _______________________________________________ wxpython-users mailing list wxpython-users@... http://lists.wxwidgets.org/mailman/listinfo/wxpython-users |
| Free embeddable forum powered by Nabble | Forum Help |