472,331 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

wxpython and wxlocale

Ya
Problem:
In a computer it is wanted to install an application that must show
information in different languages.
Thanks to the module we, gettext, have been able to implement that the texts
that are shown are translated.
The user selects the language and act from a file .mo every language.
The problem are the messages and dialogues since it shows the buttons in the
language of the operating system by default.
Is there any way of telling python that the text of the dialogues is in a
specific language?
And in affirmative case. How is it made? since all the attempts have been
useless.
I think that wxLocale has to be used, but I do not become clear.

We are using Python 2.3.3 and wxpython 2.4.2.4 in W2K.

Greetings.

Jul 18 '05 #1
4 3144
Ya <tm*******@ammsoft.com> pisze:
Is there any way of telling python that the text of the dialogues is in a
specific language?
And in affirmative case. How is it made? since all the attempts have been
useless.
I think that wxLocale has to be used, but I do not become clear.


loc = wx.Locale()
loc.Init(wx.LANGUAGE_POLISH)

Et voila, your program uses Polish dialogs.

--
Jarek Zgoda
Unregistered Linux User #-1
http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/
Jul 18 '05 #2
Jarek Zgoda wrote:
Ya <tm*******@ammsoft.com> pisze:

Is there any way of telling python that the text of the dialogues is in a
specific language?
And in affirmative case. How is it made? since all the attempts have been
useless.
I think that wxLocale has to be used, but I do not become clear.

loc = wx.Locale()
loc.Init(wx.LANGUAGE_POLISH)

Et voila, your program uses Polish dialogs.

And if you want to internationalize your OWN dialogs:

http://wiki.wxpython.org/index.cgi/Internationalization

Brian

Jul 18 '05 #3
Ya
This is my code:
The button of "OK" is not translated.
What is wrong ?

#I have a mo file named myapp.mo for translate my own dialogs.
#its containt
#....
#....
#: myapp.py:23
#msgid "Hello World"
#msgstr "Bonjour Monde"
#...
#in this location .\locale\fr\LC_MESSAGES

import gettext
from wxPython.wx import *
import wx
import locale
import sys, os, time

def startapp(self):

self.loc = wx.Locale()
self.loc.Init(wx.LANGUAGE_FRENCH)

gettext.translation("myapp", ".\locale",languages=['fr']).install()

#display then message "Bonjour Monde", but the OK button not is
translate!!!!!
dlg = wxMessageDialog(None, _('Hello World'),'', wxOK |
wxICON_INFORMATION)
try:
dlg.ShowModal()
finally:
dlg.Destroy()

class BoaApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
startapp(self)
return True

def main():
try:
demopath= os.path.dirname(__file__)
os.chdir(demopath)
except:
pass
application = BoaApp(0)
application.MainLoop()

if __name__ == '__main__':
main()

"Jarek Zgoda" <jz****@gazeta.usun.pl> escribió en el mensaje
news:bv**********@atlantis.news.tpi.pl...
Ya <tm*******@ammsoft.com> pisze:
Is there any way of telling python that the text of the dialogues is in a specific language?
And in affirmative case. How is it made? since all the attempts have been useless.
I think that wxLocale has to be used, but I do not become clear.


loc = wx.Locale()
loc.Init(wx.LANGUAGE_POLISH)

Et voila, your program uses Polish dialogs.

--
Jarek Zgoda
Unregistered Linux User #-1
http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/

Jul 18 '05 #4
"Ya" <tm*******@ammsoft.com> writes:
This is my code:
The button of "OK" is not translated.
What is wrong ?


I believe this was discussed recently on the wxPython list. Under
Windows, wxMessageDialog creates a native Windows dialog, so
wxPython/wxWindows is not in control of the basic dialog buttons (such
as OK). They are therefore under control of the OS as far as
internationalization goes, and will only obey the system settings.

So if you need to operate in a localized setting other than that of
the host operating system, I'm guessing you're best bet is to make
your own dialog box rather than using wxMessageDialog.

To add to the complexity (if I recall correctly), wxMessageDialog is
implemented by wxWindows itself under Linux/GTK, so you don't see the
same problem there. Clearly not an ideal situation, but one of the
wrinkles that comes from trying to use native widgets on a platform
when available.

The wxPython list is probably a better place to get further details.

-- David
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Logan | last post by:
Is it possible to tell the wxPython widgets (e.g. file dialogs) to use another language (instead of English)? Thanks in advance for any hints! ...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I...
25
by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of...
1
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix...
1
by: James Stroud | last post by:
Hello All, I will soon have an excuse to install a new operating system on my computer. I would like to know exactly what operating system I...
25
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many...
4
by: stef | last post by:
hello, I'm trying to move from Delphi to Python (move from MatLab to Python already succeeded, also thanks to this discussion group). From the...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.