Wednesday, June 30, 2010

Re: vimdiff-like highlighting within the same file?

On Mi, 30 iun 10, 13:32:22, Marc Weber wrote:
>
> Can't you just provide two files? The old and the new one? Most VCS
> systems do that anyway

vimdiff can be used (but it's not ideal) if you have access to the
previous .po file, but this is not always the case. Especially bigger
projects will only provide .po files through some web interface.

> #| msgid ""
> #| "The following disk access storage devices (DASD) are available. Please "
> #| "select each device you want to use one at a time."
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ old English msgid
>
> You can get rid of those comments: :g/^$|/d
> Then you can diff old and new files directly

Not really. The workflow is like this (best illustrated with a sample):

#: ../file.c: 123
msgid "translatable string"
msgstr "translation of the string"

1. programmer changes the translatable string in the program source code
and uses automated tools to update the .po. During this update the
changed msgid is completely replaced with the new one (might involve
wrapping changes)
2. fuzzy flag is set for the respective string
3. (optional) for the benefit of translators the old msgid is *added* to
the file and marked as such with the '#|'

#: ../file.c: 123
#, fuzzy
#| msgid "translatable string"
msgid ""
"This is the new translatable string, too big to fit on one line, which"
"is why the line is wrapped"
msgstr "translation of the string"

a) the translator opens the new .po file and updates the translation
b) removes fuzzy flag (and the previous msgid if present) to indicate
that the translation is now ok

#: ../file.c: 123
msgid ""
"This is the new translatable string, too big to fit on one line, which"
"is why the line is wrapped"
msgstr ""
"new translation ....................................................."
"................................................."


(of course, this example shows a big change, were highlighting the
changes is rather unnecessary, but I think you get the point and why the
usual diff tools are not very useful)

> Then translater will see as well what changed.
> Moreover they can see if a id changed but the translation was not
> changed yet.

The fuzzy flag already shows that.

> Scripting up the solution I proposed can be done in several minutes.
> However I'm not sure wether it serves you best?

Because the previous msgid is not needed in the translated .po file I
thought of pre-processing the .po file[1]. Unfortunately I don't have
the programing skills for that either :(

[1] http://nuvreauspam.ro/2010/05/6-translate-tool-needed/

> Do your translators know Vim ? Or do they use it because of the syntax
> highlighting? I"m asking because there are existing gui solutions.

The translator is me :) I already tried the GUI tools, but I still
prefer vim, even without this feature.

I'm also sure, that any other translators using vim will be very
grateful for such a feature, which is why I plan on submitting the
feature as patch to the ftplugin or the syntax file for .po (whatever
makes more sense).

Regards,
Andrei
--
If you can't explain it simply, you don't understand it well enough.
(Albert Einstein)

No comments: