[PATCH 0 of 9 ] prevent translation for some rst syntax
Simon Heimberg
simohe at besonet.ch
Thu Feb 20 09:43:40 CST 2014
Am 08.02.2014 12:17, schrieb Martin Geisler:
> Simon Heimberg <simohe at besonet.ch> writes:
>
>> In the past, rst syntax has been translated several times. Improve the
>> situation by two concepts. Translation files do not contain entries
>> containing noting but directives (rst syntax: ..XXX::) and
>> untranslatable arguments. And remind the translator by writing a note
>> before paragraphs with directives.
>
> Great stuff! If we try to move to the long
>
> .. note::
>
> This is the note.
>
> syntax, then the translators will be almost completely shielded from the
> rst syntax.
We already do this in the code. There is a check-code rule for this. But
obviously we don't do it in mercurial/help/*.txt. I have sent a patch
which is already applied.
>
> This made me think of something else: would it make sense to strip
> leading whitespace when generating hg.pot? I'm thinking of turning
> source like this (from 'hg help add'):
>
> If no names are given, add all files to the repository.
>
> .. container:: verbose
>
> An example showing how new (unknown) files are added
> automatically by :hg:`add`::
>
> into msgids like
>
> msgid "If no names are given, add all files to the repository."
> msgstr ""
>
> msgid ""
> "An example showing how new (unknown) files are added\n"
> "automatically by :hg:`add`::"
> msgstr ""
>
> I think we could still lookup the right text at translation time by
> stripping leading whitespace, do the lookup, and then adding it
> afterwards -- this is actually just like how we split paragraphs.
>
> The advantage would be that translators seen even less rst syntax and
> wont have to deal with keeping the indentation consistent.
>
>
Very interesting idea!
some steps to go:
* add a test for posplit (in preparation)
* find and fix some corner cases
* teach posplit to remove indentation
(keeping all comments, not generating double entries)
* teach mercurial to use this translations
* in mercurial.i18n
* or when generating xx.mo
* (maybe restart from step 3 and teach posplit to do it even better)
Some questions:
= different indentation =
What should we do with such a paragraph?
" aaa\n"
" bb"
Probably convert to this?
"aaa\n"
" bb"
Probably not to the following, because we can not know when the
indentation should occur in the translation. (The number of lines can
vary to the original.)
"aaa\n"
"bb"
= corner case: command options =
Command options need special handling.
translated is this:
"this option does something very interesting with"
it is shown like this (in hg help):
-x --example this option does something very interesting with
When the translation is much longer than the original, we need a line
break. But the 2nd line must start intended. This is not visible form
the original, so do not bother the translator with this.
I prepare a patch series handling this in mercurial.minirst.maketable
(for hg help) and in gendoc.get_opts (for generating documentation).
No idea if there are similar problems in other places. Anybody knows
about one?
= when to look up indented =
Instead of removing and adding the spaces on runtime, we could also do
this when generating xx.mo (by generating it form a temporary
indented_xx.po.tmp). But not sure if this is nicer.
More information about the Mercurial-devel
mailing list