Localization Guide ja

From ADempiere
Revision as of 07:46, 6 May 2012 by Syatsuzuka (Talk) (ローカル勘定科目のインポート)

Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

ローカライゼーション

ADempiereをどこの国でも利用できるようにするためには、ローカル言語および会計システムへの適用が必要です。完全な翻訳作業には6人月程度を必要としますが、ヘルプファイルなどを対象外とすれば、2カ月以内で実施できるでしょう。また、アプリケーションでのみ利用される部分の翻訳であれば、会計部分の対応と並行して行うことができるため、3-4週間で行うことができるかもしれません。

  • ADempiereのローカライズとしては以下ステップが挙げられます:
  1. 用語集の作成
  2. メニュー、タブ、ヘルプファイル等の翻訳
  3. ローカル勘定科目の取り込み


用語集の作成

翻訳作業に入る前の最初のステップは、用語集の整備です。これにより翻訳作業を簡潔にし、エンドユーザが「対象が同じなのに、このタブではドキュメント(Document)と表記し、他では証明書(Voucher)と表示している」というような不満をさけられることができます。一方、このことは、事前に翻訳される文字列のすべてを読み、用語として書き出す必要があることを示します。用語集は一般的にテキストファイルもしくは、2列からなるスプレッドシートの形式を取ります。

ADempiereの翻訳

ADemiereの翻訳には2つの方法があります。ADempiereを通して直接、翻訳することもできれば、.xmlファイルをエクスポートし、翻訳メモリーツール(オリジナルの記述と翻訳の双方が記述された巨大なXMLファイル)を用いた翻訳の方法が挙げられます。翻訳メモリツールを用いることの利点としては、用語が繰り返して登録されている部分に対して、ツールはマッチングフレーズを用いて自動的に置換します (ADempiereには、6,500語の用語が反復して登録され、10,500語もの用語登録が行われています)。その上、ツールは用語比較を行い、テキストのタイピングを減らすように、最も近いと予想される用語の提示をおこなってくれます (これはバージョンアップの際には、とても有効に機能します!)。こちらは専門的な方法にあたります。欠点は、大きなプロジェクトにおいては、もっとも有効ですが、小規模なプロジェクトにおいては、オーバーヘッドとなるでしょう。このことはXMLファイルに記載されているものに対してのみに対する翻訳でであり、XML内の記載が、ERP上のどこの表示と対応づいているか、わからず、XMLファイルのすべてに対して翻訳を行うことになるかもしれません。ADempiereのXMLファイルにて作業を行う最適なツールについては、残念ながらオープンソースではありませんが、Multilizerをご覧ください。

ERP上での翻訳設定

ERP内部での翻訳は簡単です。"翻訳(translation)"メニューを検索し、英語のフレーズを確認の上、対応するローカル言語のフレーズを入力するだけです。不都合な点としては、一度大量のエントリーを翻訳した後は、同様の手順で再度繰り返したくないでしょう。すなわち、翻訳の途中で、用語を変更したくなった場合、すべての箇所を手動で変更しなおさなければなりません (それが用語集が重要となる理由です)

Launchpad.netでの翻訳

  • これは新しいバザール方式でのADempiere ERPの翻訳です。簡単であり、ファンシーな方法です。
  • 詳細についてはJa/TranslationProjectおよびADempiere Translation Project in Launchpad.netをご確認ください
  • それはどのようなものですか?
    • もしローカル言語がADempiere Translation Projectに登録されていない場合は、Ubuntu translation projectを参照ください。(日本語はすでに登録されています)
    • きっとあなたの言語がそこで確認できるでしょう。いくつかの例を以下に記載します:

Spanish, Thai, Malay, German, Chinese (Simplified), Russian on the launchpad.net


翻訳メモリを用いた、.xmlエクスポートファイルからの翻訳

翻訳メモリを利用するためには、ADempiereから翻訳情報をエクスポートする必要があります。エクスポートフォーマットは多数の英語フレーズとローカル言語に対応するフレーズからなる、巨大なXMLファイルとなっています。現在、Multilizerが唯一、ローカル言語の翻訳を行うソフトウェアとなっていますが、オリジナルの項目を翻訳しているわけではありません。また、エクスポートされたファイルの翻訳として、XMLエディタをりようすることもできます。エクスポートされた翻訳対象のテキストを.csvファイル形式に翻訳し、OpenOffice spreadsheetフォーマットに保存します。そして、その翻訳として、OmegaTを用います。ここでの問題としては、翻訳をXMLファイルに戻すことが難しい点です。一方、OmegaTを用いることで、standards compliantの翻訳メモリを.tmx (翻訳メモリ変換フォーマット)形式で取得できます。.tmx形式の翻訳メモリは、Multilizerの評価版にて、XMLファイルを数秒の内に自動翻訳することを可能とします。しかしOmegaTを単体利用するにはトリックがありますので、以下を参照ください。

OmegaTのみを用いる、エクスポートされた.xmlファイルの翻訳

オープンソースツールOmegaTのみを用いることによる、もうひとつの方法があります。Multilizerへの変換を行うことなく、OmegaTによるHTMLファイルの編集機能を利用することで対応可能です。ADempiereからエクスポートされるXMLファイルは、<value>のXMLタグからなります。ここでは代表的なものを以下に記載します。

  • <value column="Name" original="Client">Client</value>

OmegaTは、<value>のXMLタグを認識しませんが、<p>については、HTMLタグに該当するため、認識されます。よってここでのトリックは、sedやnawkのようなテキスト編集ツールを用いて、以下に示すサンプルスクリプトを参考に、<value>を<p>に置換します。この方法により上に示すXMLタグは以下に示すHTMLタグに変換されます:

  • <p column="Name" original="Client">Client</p>

OmegaTは、開始タグの中に含まれる'original='の後に続く文字列についても、オリジナル(英語)の用語として認識します。そして、翻訳対象の用語については、開始と終了タグの間の文字列となります。翻訳がおこなわれていない間は、双方の文字列はClientとなっています。OmegaTによる翻訳を通して、次に示す翻訳タグを含むような、新しく翻訳されたHTMLターゲットファイル(ドイツ語の例)が生成されます:

  • <p column="Name" original="Client">Mandant</p>

次の作業としては、<p>タグを<value>への変換と翻訳言語の指定です。翻訳XMLファイルを取得するここでの方法により、ADempiereへのインポートの準備が整いました。以下から、sedを用いて、双方向でのタグの変換を行う、bashスクリプトの2つの例をご参照ください。XMLファイルのAD_Element_Trl_en_US.xmlおよびde_DEは例です。

<value> タグから <p> タグへの変換を行うサンプルスクリプト (XML to HTML)
INPUTFILE=AD_Element_Trl_en_US.xml
OUTPUTFILE=AD_Element_Trl_de_DE.html
cat $INPUTFILE > temp
# replace language=en_US by language=de_DE
sed 's:language="en_US":language="de_DE":g' temp > temporary
cat temporary > temp
# replace XML flag <value> by HTML flag <p>, done for start and end flag in one go
sed 's:<value column="\([^"]*\)" original="\([^"]*\)">\([^<]*\)</value>:<p column="\1" original="\2">\3</p>:g' temp > temporary
cat temporary > $OUTPUTFILE
<p> タグから <value> タグへの変換を行うサンプルスクリプト (HTML to XML)
INPUTFILE=AD_Element_Trl_de_DE.html
OUTPUTFILE=AD_Element_Trl_de_DE.xml
cat $INPUTFILE > temp
# replace HTML flag <p> by XML flag <value>, done for start and end flag in one go
sed 's:<p column="\([^"]*\)" original="\([^"]*\)">\([^<]*\)</p>:<value column="\1" original="\2">\3</value>:g' temp > temporary
cat temporary > $OUTPUTFILE

XMLファイルの翻訳を行いました - OmegaTはさらなるリリースに対して、再利用できるのでしょうか?

During translation OmegaT produces a standards compliant translation memory in .tmx (translation memory exchange) format. These translation memory files are used by OmegaT to show fuzzy matches to the translator, i.e. translations, which fit more or less to the actual term to be translated. In order to take over the translation proposal, the translator has to click on it. When going over from one ADempiere release to another, this would mean, the translator would have to click thousands and thousands of times to take over existing translations to the new release. This can't be the direction to go!

But there is another trick: OmegaT uses internally a specific file also in tmx format. This file is called project_save.tmx and is an internal storage containing translations, which have already been done on the current source file. Therefore all translations saved in project_save.tmx are executed automatically by OmegaT to a related source file at the moment, the file is loaded into the program to continue translation work on it.

The idea is now to take any tranlated XML file and create a related file in tmx format out of it. Once, we have such a file, we can copy it to OmegaT's translation memory in order to get fuzzy matches displayed, or, even better, we create a tmx file with correct header and footer, thus cheating OmegaT by pretending to be its internal translation storage. OmegaT will accept the file as its project_save.tmx file, when we copy it to the right place (this is below a subdirectory called omegat) and overwrite a file, which might already exist there. OmegaT then executes automatically all applicable translations in this project_save.tmx file, removes the ones not applicable and writes a nicely formatted new project_save.tmx file at the moment the translator presses the save button. I have to admit, this is not a recommended proceeding (I didn't find any description like this in OmegaT's documentation), as OmegaT assumes project_save.tmx to be for internal use, only. Though it works, at least with OmegaT version 1.6 RC12, which I used.

Question remains how to transform the translation of English Client into German Mandant, for example, as typical part of one of the translated XML files, looking like this:

<value column="Name" original="Client">Mandant</value>

into the related tmx format, as shown below:

<tu>
  <tuv lang="EN-US">
    <seg>Client</seg>
  </tuv>
  <tuv lang="DE">
    <seg>Mandant</seg>
  </tuv>
</tu>

The bash script in next chapter does this for you. Moreover, it inserts the necessary header and footer to the project_save.tmx file. At least the header probably needs to be adapted to the OmegaT version used! Have a look to part 'Write header to tmx file' inside script below. All lines between the one ending with EOF and the line containing just EOF are copied 1 to 1 to the output file. So, in order to adapt the script to the header you need, you have to recognize the following structure:

cat > $OUTPUTFILE <<-EOF
These 3 lines
are copied as they are
to the outputfile.
EOF


<value> タグからtmxへの変換を行うサンプルスクリプト (XML to Translation Memory)
INPUTFILE=AD_Element_Trl_de_DE.xml
OUTPUTFILE=project_save.tmx
cat $INPUTFILE > temp

# remove header
sed 's:<?xml.*table="AD_[^"]*">::g' temp > temporary
cat temporary > temp
# remove footer
sed 's:</adempiereTrl>::g' temp > temporary
cat temporary > temp
# remove row end and start tags
sed 's:</row>::g' temp > temporary
cat temporary > temp
sed 's:<row[^>]*>::g' temp > temporary
cat temporary > temp
# replace value start tag, but keep english text, i.e. text after 'original='
sed 's:<value column=[^g]*ginal="\([^"]*\)">:<tu><tuv lang="EN-US"><seg>\1</seg></tuv><tuv lang="DE"><seg>:g' temp > temporary
cat temporary > temp
# replace value end tag, translated (german) text in front of that tag is not touched
sed 's:</value>:</seg></tuv></tu>:g' temp > temporary
cat temporary > temp


# Write header to tmx file. This part needs to be adapted, if another OmegaT version is used.
cat > $OUTPUTFILE <<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tmx SYSTEM "tmx11.dtd">
<tmx version="1.1">
  <header
    creationtool="OmegaT"
    creationtoolversion="1.6 RC12"
    segtype="sentence"
    o-tmf="OmegaT TMX"
    adminlang="EN-US"
    srclang="EN-US"
    datatype="plaintext"
  >
  </header>
  <body>
EOF


# write all translations in tmx format to tmx file
cat temp >> $OUTPUTFILE


# write footer to tmx file
cat >> $OUTPUTFILE <<-EOF
  </body>
</tmx>
EOF

ローカル勘定科目のインポート

会での利用のためには、ADempiereでは、ローカル勘定科目に対応する、75個までの基本的な勘定科目のセットが必要となることから、経験のある会計士のサポートが必要となるでしょう。それぞれの国での会計システムの差異から、これら勘定科目は国ごとに異なるでしょう。あなたの顧客の会計士から、サポートを得られるようにアプローチすることは、いずれ、個各の利益にもつながることでしょう。

便利サイト