[XML-SIG] Will gettext do?
Uche Ogbuji
uche.ogbuji@fourthought.com
Tue, 30 Jan 2001 01:32:55 -0700
OK. I've hacked away at it with a vengeance, and I nearly have gettext
working in 4Suite on my computer, but I'm beginning to wonder whether gettext
is not too brittle a solution.
Basically, I changed the en_US.py files to MessageSource.py files, used the
following globally:
try:
import gettext
gettext.install('4Suite')
except:
def _(msg):
return msg
And wrapped all the strings in "_()". That was all the easy part.
Then came the issue of building this thing. I ended up checking pygettext.py
into Ft/admin, and importing the right objects (TokenEater, Options, etc.).
After a lot of hacking, I got a usable distutils module that could prepare
4Suite.pot files and put them in the corresponding location in
site-packages/Ft or whatever. I verified that all the messages were extracted
and all that.
Victory, right?
Hell no!
It turns out that the .pot files are useless. Even Python's gettext module
requires GNU gettext and the binary .mo files.
So first of all, this seems a non-starter in Windows.
So I wandered off to find out how to make these .mo files. Never mind that I
can't bloody get the GNU gettext command-line processor to do anything
regardless of how many options and environment variables I throw at it. It
looks as if even if I get it to work, I'm going to need full access to
/usr/share/locale on the machine.
So it's also a non-starter unless one can get root to install it.
I assume I'm missing a great deal here, because if not, I don't see how
pygettext is usable as a general i18n solution.
And I've read and re-read the Python 2.0 gettext docs. What I can follow of
it isn't very promising.
Help?
--
Uche Ogbuji Principal Consultant
uche.ogbuji@fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python