Localizing strings?
Fredrik Lundh
fredrik at pythonware.com
Mon Sep 6 03:25:51 EDT 1999
Preston Landers <mithy at my-deja.com> wrote:
> Is there an easy way to use translatable strings in your Python program
> a la GNU gettext? The os.localize module doesn't seem to do what I need
> to do. can anyone point me to some documentation or examples?
how about:
# Translate.py
messages = {}
# ... check environment variable to figure out what file
# to load, and load it using marshal, fp.readlines, pickle, ...
# do it by hand, for now...
message["hello, world"] = "tjaba"
def T(message):
return table.get(messages, messages)
and:
# main
from Translate import T
print T("hello, world")
</F>
More information about the Python-list
mailing list