[PATCH] ui: extract choice from prompt

Martin Geisler mg at lazybytes.net
Tue Jul 7 10:39:35 CDT 2009

Simon Heimberg <simohe at besonet.ch> writes:

> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1245539599 -7200
> # Node ID b615ecb9cc81f6c48b4cbcaf2dc1b05a9006bd75
> # Parent  fc1cfff940fdb1b3ef3badad42d29135e6ee1120
> ui: extract choice from prompt
> avoid translating single characters (as l for _local or sym_link)

I've pushed this as revision 38b5d5e0efab, thanks.

If we get tired of the indices, we could begin *not* translating the
response choices when promptchoice is called, but inside it. A call
would look like this:

  r = ui.promptchoice("do it?", (gettext_noop('&Yes'),

where the idea is that gettext_noop does nothing, except informing
xgettext to extract the strings '&Yes', '&No', and '&Maybe' into the
message catalog.

promptchoice could then return one of 'y', 'n', 'm' -- it can do that
because it has access to the untranslated strings.

The traditional name for such a no-op function is "N_" but it doesn't
look very pythonic to me.

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090707/2cc39fc9/attachment.pgp 

More information about the Mercurial-devel mailing list