[PATCH 0 of 7] Gettext infrastructure and Danish translation

Martin Geisler mg at daimi.au.dk
Fri Aug 22 13:15:43 CDT 2008


Matt Mackall <mpm at selenic.com> writes:

> On Fri, 2008-08-22 at 17:16 +0200, Martin Geisler wrote:
>
>> * Some strings use abbreviations ('repo', 'rev') which can be
>>   difficult to carry over.
>
> Probably shouldn't? If you translate the 'jargon', you're going to
> have to consistently translate all the documentation sources.

Yeah, I don't know what people do here... I don't even know which
Danish word I would use for 'repository' :-) Subversion has a Swedish
translation which uses 'arkiv' meaning 'archive'.

I'll leave that up to the translators, I'm actually more interested in
the infrastructure.

>> * Much of the help is in docstrings -- and pygettext.py can extract
>>   those. But we don't want to translate all docstrings...
>
> I was worried about extracting those. We'll need a bit of smarts in
> help() for this too, no? I think we only care about commands.py and
> extensions?

Yes, we definitely need some logic in the help_ function in
commands.py. I also just found the helptable in help.py -- that needs
a dose of _().

About the extensions: it is no problem translating the ones that come
with Mercurial, we just extract the strings and put them in hg.pot.
But third-party extensions will not be able to provide translations
since the code only looks in locale/XX.mo.

As I understand it, the extensions would have to use the dgettext
function which has an extra argument for a domain. The translation
would then come from locale/XX/domain.mo.

Hmm, so I could change the patches so that da.po generates

  locale/da/LC_MESSAGES/hg.mo

and then replace the custom translate function I wrote with something
that simply specifies a localedir! Third-party extensions could do the
same and everything should be able to co-exist... I'll revise that
patch... :-)

>>   Also, the record extension runs *part* of a docstring through _()
>>   which is clever, but not such a good idea from a translation point
>>   of view.
>
> ?

Yeah, that was not so well explained... record does this in line 288:

                    if l: ui.write(_(l.strip()), '\n')

where l is a line in the docstring from the record function...
pygettext.py wisely gives a warning about this because it cannot
extract anything from this.

> Looks promising.

Thanks!

-- 
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/20080822/caa7607d/attachment.pgp 


More information about the Mercurial-devel mailing list