Ale,

I was wondering if you eventually had considered this procedure. I works very correctly and considerably increases productivity thanks to OmegaT's HTML handling features. I think I'm going to investigate the possibility of having an .sdf filter for OmegaT rather than having to go through all the po loops that really don't provide much more than yet another intermediate format that is anyway inconvenient to translate.

JC

On 7 juil. 07, at 00:41, Jean-Christophe Helary wrote:

The reason why I tried to do that is because using the .po created with oo2po along with the TMX created with po2tmx does not work well. The po2tmx removes data from escape sequences and that means more things to type in the OmegaT edit window.

So, the idea was to consider the .sdf file as a pseudo HTML file to benefit from a few automatic goodies offered by OmegaT: 1) tag reduction (so that one needs to type less when tags are inline) and 2) tag protection (for block tags like the <ahelp>...</ahelp> when they open and close the segment)

if the TMX could be hacked to show formatting tags similar to the modified source file it would become trivial to edit the tags and reflect the new contents found in source.

Problem is, an .sdf file is not a HTML file: there is plenty of meta information and a lot of escaped "<", ">" and others. Also, a .sdf file seems to be constituted of 2 lines blocks: the source line and the target line.

The first problem will be solved later, now, to extract the translatable contents we need to change the 2 lines blocks into one line blocks with source and target data next to each other.

This is does using a regexp like (those are not exact, I do them from memory plus they may change depending on the editor you chose):

search for:
^(.*)(en-US)(.*)\r^(.*)(fr)(.*)
replace with:
\1\2\3\t\4\5\6

Now that your .sdf is "linearized", change its name to .csv and open it in OpenOffice by using "tab" as field separator and "nothing" as text delimiter.

The tabs in the original .sdf create a number of columns from where you just need to copy the column with the en-US translatable contents.

Paste that into a text file that you'll name to .html

Now, we need to convert this to pseudo HTML. The idea being that OmegaT will smoothly handle all the <ahelp> etc tags that will be found there.

First of all, we need to understand that not all the "<" are tag beginning characters, a number of them are simply "inferior" characters. So we grab those first:

search for:
([^\])<
replace with:
\1&lt;

">" are less of a problem but let's do them anyway:

search for:
([^\])>
replace with:
\1&gt;

Now we can safely assume that all the remaining "<" or ">" are escaped with "\" and to correct that (so that the non escaped tags can be recognized in OmegaT) do:

search for:
\\<
replace with:
<

search for:
\\>
replace with:
>

Last but not least, to ensure that OmegaT will consider each line as being a segment we need to add the "paragraph" mark to each line beginning:

search for:
^
replace with:
<p>

Save, the file should be ready to be processed.



Now, we need to get matches from the TMX files that either we have created (oo2po -> po2tmx) or that Rafaella & all have provided us with.

Problem is that the TMX files reflect the contents of the .sdf that we have just modified.

In the TMX, we are likely to find an <ahelp> tag written as \<ahelp something\> which will not be helpful since in OmegaT the <ahelp> tag will be displayed as <a0> and thus will not match the \<ahelp something\> string.

So, we need to hack the file so that it looks close enough to what the source expects...

In the TMX we want to reduce _all_ the escaped tags to a short expression that looks like <a> for a tag starting with "a".

So we would do something like (here again, not 100% exact regexp).

search for:
\\<(.)[^>]*>
replace with:
&lt;\1&gt;

same for tail tags:
\\</(.)[^>]*>
replace with:
&lt;/\1&gt;

If I remember well everything I did in the last few days that is about it. Save the TMX, put it in /tm/, load the project and translate...

You can also put the Sun glossaries in /glossary/ after a little bit of formatting. But that too is trivial.


When translation is done, it is important to verify the tags (Tool - > Valitate tags) click on each segment where the tags don't with source and correct the target.

Then Project -> Create translated files

Get the translated .html file from /target/

And now we need to back process the whole thing to revert it to its original .sdf form.

1) remove all the <p> at the beginning of the lines
2) replace all the < with \<, all the > with \>, all the &lt; with < and the &gt; with >


This should be enough. Now copy the whole file and paste it in the target contents part of the still opened .csv file.

The .csv file now contains the source part and the target part next to each other.

Let's save this (be careful: "tab" as field separator and "nothing" as text delimiter).

Open the result in the text editor.

The pattern we need to find to revert the 1 line blocks to 2 line blocks is something like:

(something)(followed by lots of en-US stuff)a tab(the same something)(followed by lots of translated stuff)

^([^\t])(.*)\t\1(.*)$
and we need to replace it with:
\1\2\r\1\4

Make sure there are no mistakes (if there are any they are likely to appear right in the first lines).

Now you should have your 2 lines block.

Rename the file to .sdf and here you are.



This whole process is a bit tricky but the advantage of using OmegaT on such a big translation is just so much worth it that I really suggest you give that a try. The conversions does not take much time and requires only one person preparing the files.

I hope that helps, even if it is a bit late :)

Jean-Christophe

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to