[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openoffice:10573]O Oo/ODF翻訳作業(京都でセミナー)



現在2.3の翻訳作業は進んでいるはずですが、l10n@devの 方に「.sdfファイルをどうやって直接OmegaTで翻訳でき る」という英語ポストを送りました。このメールの下にそれをペースト します。

それと、最新ニュースとして、OmegaTの最新テスト版が公開され て、最新版の日本語取扱説明ガイドも含まれています。
(「Other - Development|OmegaT 1.7.1」というところ になります)

面白い新しい機能は:mediawikiソースファイルをインポートす る機能が付きました。それを使って、他の言語で書かれている mediawikiのファイルを簡単にインポートして、翻訳ができるようにな ります。翻訳したファイルは手動でアプロードしないといけないけど…


(興味のある方はmediawikiインポートを使ってenページ を訳してみてください!)

Wordならばとても高い翻訳支援ソフトを購入しなければ難しい作業はこ のOmegaTを使ってOOoのファイル形式であるODF (ISO-IEC 26300)をとても簡単に翻訳ができます。

来週のOpen Source Conference 関西・京都でOmegaTの新 機能やワークフローについてセミナーを行います(金・土、両方)。土 曜日の午前中はFOSS翻訳の2時間ハンズオンも予定されています!


翻訳関係の方は(OOoのl10nの方も当然)是非参加してく ださい!


	Subject: 	[l10n-dev] Translating .sdf files directly with OmegaT
	Date: 	7 juillet 2007 00:41:25 HNJ
	To: 	  dev@l10n.openoffice.org
	Reply-To: 	  dev@l10n.openoffice.org

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:
replace with:

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:

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

search for:
replace with:

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:

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:

same for tail tags:
replace with:

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)

and we need to replace it with:

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 :)



    ■■■  freemlはリニューアルいたしました!  ■■■