gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnue-dev] i18n patch


From: Aditya Gilra
Subject: [Gnue-dev] i18n patch
Date: Fri, 14 Jun 2002 21:41:29 -0700 (PDT)

||Shriharih||

God-remembrance.

I'm attaching 2 files that allow us in India to enter
data in Hindi (forms
driver). It should work for a lot more locales.
First a little background.

1. wxpython does not support unicode even though
wxwindows does.
wxwindows(wxgtk) even though it supports unicode, will
not support the various
context dependent ligatures required to display Hindi
since it is based on gtk
1.2 .

2. gtk 2.0 uses pango 1.0 which renders Hindi quite
well. Until wxgtk is based
on gtk 2.0, we need to use pygtk2.0 (1.99.10) to be
able to enter Hindi.

3. pygtk 1.99.10 requires python 2.2, gtk 2.0. I'm
running it on Redhat 7.3 .

4. One needs to set the locale to hi_IN.UTF-8 (gtk
takes utf-8 by default). You
also need a keyboard driver to support Hindi (I
dnloaded one made by Robert
Brady).

5. I'm using utf-8 throughout - in database and in
forms and in the ui driver.
It's the easiest for Hindi as it is requires no
modifications in postgresql and
very simple modifications in forms. In fact, one can
mix any combination of
languages in a single entry.

The first file is a replacement for UIdriver.py in wx.
You could create a new
folder for it called pygtk. It does not yet support
clipboard, scrollbar and
some minor features. There is some problem with tabbed
pages - one needs to
switch pages in backward order to display them
correctly.

The second file is a replacement for
GFDisplayHandler.py . There are very minor
changes here in the method - addText(self, event).
This was required because utf-8 is a multi-byte
variable-length encoding. Hence
cursor position is not the same as byte position. So
we just need to convert
value to a python unicode string using
[unicode(entry.text, 'utf-8')] before
entering the function and convert back to utf-8
[ codecs.utf_8_encode(self.work)[0] ] on leaving the
function. This is required
so that len() returns number of characters and not
number of bytes.

Hope the same is useful and can be folded into the
code.

Best Regards,
Aditya Gilra & Raghav Mittal.



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

Attachment: UIdriver.py
Description: UIdriver.py

Attachment: GFDisplayHandler.py
Description: GFDisplayHandler.py


reply via email to

[Prev in Thread] Current Thread [Next in Thread]