[Zope3-dev] Job Board Example

Barry A. Warsaw barry@zope.com
Mon, 17 Jun 2002 23:52:21 -0400


>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

    GvR> It may be too late for the job board, but I think the choice
    GvR> of explicit msgids may become very important.  I was
    GvR> confronted with a whole slew of single-word messages, and I
    GvR> couldn't recall from which parts of the interface they were.
    GvR> There are several plausible translations for e.g. "Submit"
    GvR> and they depend on the context.  It would be good if more
    GvR> context was conveyed through the msgid (e.g. is it a button
    GvR> label, a column heading, a menu entry, etc.).

More context is definitely required.  Note that both gettext and
pygettext include a lot more information with each msgid entry in the
.po file.  It will include all the files and line numbers where that
msgid appears.  po-mode has keybindings to pop you right to that
position in the file so you can figure out what the context is.

But of course, that doesn't solve the problem of "Approve" appearing
multiple times in different files, but in contexts that call for
different translations.  That's exactly where explicit msgids are a
win because with the implicit msgids of gettext, you have to play
stupid games like adding useless "&nbsp;" to distinguish different
contexts.

But explicit msgids are more work, because they require you to have a
translation file in the source language (e.g. English), and it would
really suck if that translation isn't complete.  You don't want to see
"job-board-approve-button" in your u/i.  I think explicit msgids also
make it a bit more work for incomplete non-source language
translations, because you have to be more careful about your fallback
heirarchy (you probably don't want to rely on falling back to the
explicit msgid).

    >> For a while I've thought that explicit msgids are a better way
    >> to go, and I think Stephan agrees, but they aren't a great
    >> match with gettext.  Hopefully though, the gettext approach is
    >> just an interim step, because I think we can do better with a
    >> more Zope-ish approach.  Then we may want to require explicit
    >> msgids, although they can be convenient for markup like: <th
    >> i18n:translate="approve">Approve</th> since you can write that
    >> as <th i18n:translate="">Approve</th>

    GvR> Does it lowercase the contents to get the msg-id?  What else
    GvR> does it do?

Nope.  It will use an implicit msgid verbatim, except for transforming
i18n:name="thingie" into ${thingie}.

    GvR> In this case, I'd appreciated an explicit msgid with more
    GvR> context, e.g. "approve-column-label".

Agreed.  Internationalizing an application is an art!
-Barry