[PATCH] tag: allow multiple tags to be added or removed

Martin Geisler mg at daimi.au.dk
Sat Mar 8 11:10:36 CST 2008


Thomas Arendsen Hein <thomas at intevation.de> writes:

> Maybe just loop over reserved names with singular message here.
>
>> +    tag_word = (len(names) > 1 and _('tags')) or _('tag')
>
> Some languages use singular for 21, 31, ... so this will get you (or
> others) in translation hell :)

Yeah, this should be handled by Gettext. The correct way to do these
things is to use the ngettext method which takes two translatable
strings and a number, which is used to select the correct string.

In the context of the original patch where tag_word is used later like
this:

+            message = _('Removed %s %s') % (tag_word, ", ".join(names))

the correct way would be to write each alternative in full:

  from mercurial.i18n import t

  message = t.ngettext('Removed tag %s', 'Removed tags %s', len(names))
  message = message % ", ".join(names)

Of course, the "t" variable from mercurial.i18n should have a better
name, or the ngettext method should be exported directly.

Also, please note that the job of the translators is made much harder if
strings are made from smaller strings. It may make perfect sense in
English, but in other languages things might work differently.

-- 
Martin Geisler

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


More information about the Mercurial-devel mailing list