473,385 Members | 1,461 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 3204
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! -- mailto: logan@phreaker(NoSpam).net
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 wonder if I should abandon it in favor of...
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 constraints. The only reason wxPython isn't the standard...
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 with the configure script to point to where I have...
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 should have so that I can get wxPython going....
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 can use PyGTK. (...)", July 2nd, 1999 pyGTK...
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 enhancements and fixes implemented in this...
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 enhancements and fixes implemented in this...
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 discussions in this list about "the best" GUI for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.