[PATCH 0 of 1] ui: add function 'promptselection'
Martin Geisler
mg at aragost.com
Tue Aug 9 01:58:05 CDT 2011
Matt Mackall <mpm at selenic.com> writes:
> On Mon, 2011-08-08 at 16:50 +0200, Ingo Proetel wrote:
>> Hello,
>>
>> This patch introduces a new function 'prompselection' which adds some
>> functionality over 'promptchoice':
>>
>> For the hg user it will provide the possible choices in an consistent
>> way (in square brackes with the default capitalized), the sequence of
>> commands will not change through localization, and '?' will provide
>> verbose help.
>>
>> The programmer does not need to create the possible choices by hand,
>> can work with readable command instead of indices, and gets a help
>> function for free.
>>
>> Example usage:
>> choices = (('abort',_('&Abort command')),
>> ('new',_('Create &new request')),
>> ('reopen',_('&Reopen request')) )
>> request = ui.promptselection('now what?', choices,'new')
>> if request == 'abort':
>> raise util.Abort('User aborted')
>> elif request == 'new':
>> ui.status('creating new')
>> else:#request == 'reopen'
>> ui.status('reopen existing')
>
> I guess this looks good, but I'd like to see an opinion from the
> translators or THG folks.
>
> Are translations translating the -keys- used as well?
Yes, if you mean the accepted reponses to promptchoice, then yes. This
is from the Danish translation:
msgid "[Ynsfdaq?]"
msgstr "[Jnsofai?]"
msgid "&Yes, record this change"
msgstr "&Ja, optag denne ændring"
msgid "&No, skip this change"
msgstr "&Nej, spring denne ændring over"
If I understand the patch correctly, then it adds an untranslated key
that is only used internally. That seems like a fine idea.
--
Martin Geisler
aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/
More information about the Mercurial-devel
mailing list