A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-list/1999-September/005116.html below:

Localizing strings?

Localizing strings? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4