i18n: beginnings of a Danish translation

Martin Geisler mg at daimi.au.dk
Thu Jan 15 15:14:27 CST 2009


Matt Mackall <mpm at selenic.com> writes:

> Also, we need to document the best way to turn off l10n, if indeed
> want to default to on. That's not completely clear as it has both
> compatibility and performance impacts:
>
> $ hg perfstartup
> ! wall 0.049808 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
>
> $ LANG=da hg perfstartup
> ! wall 0.083391 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
>
> Almost all of that is imports that we normally don't need.

Loading the hg.mo file does take some time, but only a little more than
3 ms on my machine:

% python -m timeit -s 'from gettext import GNUTranslations' \
    'fp = open("hg.mo")' \
    't = GNUTranslations(fp)' \
    'fp.close()' \
    't.gettext("There is no Mercurial repository here (.hg not found)")'
100 loops, best of 3: 3.32 msec per loop

The NullTranslations class does not read the file at all and is of
course much quicker:

% python -m timeit -s 'from gettext import NullTranslations' \
    'fp = open("hg.mo")' \
    't = NullTranslations(fp)' \
    'fp.close()' \
    't.gettext("There is no Mercurial repository here (.hg not found)")'
100000 loops, best of 3: 9.03 usec per loop

-- 
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/20090115/c544124a/attachment.pgp 


More information about the Mercurial-devel mailing list