R.A. Epigonos et al.

[dia] 画像内のテキストを翻訳する

diaファイルはgzipで圧縮されたxmlファイル。xmlからpoに。poで翻訳。翻訳内容をxmlに適用。diaで画像出力

xml2poを使う例

翻訳したいdiaファイルをgzipでxmlファイルに展開。

$  gzip -v -l -- en-US/images/existing-setup-2.dia
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla ac1a6bee Sep 27 08:09                1498               16392  91.0% en-US/images/existing-setup-2.dia
$ gzip -v -cd -- en-US/images/existing-setup-2.dia > en-US/images/existing-setup-2.xml
en-US/images/existing-setup-2.dia:       91.0%

xml2po で xml ファイルから po-template を作り、msginit でpoファイルを生成。poファイルは適当に翻訳。

$ xml2po --mode xhtml --output en-US/images/existing-setup-2.pot en-US/images/existing-setup-2.xml
$ msginit --input en-US/images/existing-setup-2.pot --output ja-JP/images/existing-setup-2_ja.po --locale ja

翻訳した結果を xml2po で xml ファイルに適用。元の xml とどの程度違うか確認。

$ xml2po --mode xhtml --po-file ja-JP/images/existing-setup-2_ja.po --language ja --output ja-JP/images/existing-setup-2_ja.xml en-US/images/existing-setup-2.xml
$  gzip -v -l -- en-US/images/existing-setup-2.dia
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla ac1a6bee Sep 27 08:09                1498               16392  91.0% en-US/images/existing-setup-2.dia
$ diff ja-JP/images/existing-setup-2_ja.xml en-US/images/existing-setup-2.xml
1c1
< <?xml version="1.0" encoding="utf-8"?>
---
> <?xml version="1.0" encoding="UTF-8"?>
13c13
<           <string>#A4#</string>
---
>           <dia:string>#A4#</dia:string>
122c122
<               <string>#dump.ldif#</string>
---
>               <dia:string>#dump.ldif#</dia:string>
202c202
<               <string>#dump.sql#</string>
---
>               <dia:string>#dump.sql#</dia:string>
316c316
<               <string>##</string>
---
>               <dia:string>##</dia:string>
355c355
<               <string>#データベース#</string>
---
>               <dia:string>#databases#</dia:string>
390c390
<               <string>#LDAP ディレクトリ#</string>
---
>               <dia:string>#LDAP directory#</dia:string>

最後にdiaで出力。

$ dia --export ja-JP/images/existing-setup-2_ja.png ja-JP/images/existing-setup-2_ja.xml
ja-JP/images/existing-setup-2_ja.xml --> ja-JP/images/existing-setup-2_ja.png

一応出力されたpngは問題なさそう。だけどdia:stringがstringになってたりあんまり良くないかもね。

po4aを使う例

翻訳したいファイルを xml に展開

$ gzip --verbose --list -- en-US/images/existing-setup-4.dia
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla 2bdd4d8d Sep 27 08:09                1634               18667  91.3% en-US/images/existing-setup-4.dia
$ gzip --verbose --stdout --decompress -- en-US/images/existing-setup-4.dia > en-US/images/existing-setup-4.xml
en-US/images/existing-setup-4.dia:       91.3%

po4a-gettextize でpo-templateを生成。potからpoを生成。

$ po4a-gettextize --format dia --master en-US/images/existing-setup-4.xml --po en-US/images/existing-setup-4.pot
$ msginit --no-translator --input en-US/images/existing-setup-4.pot --locale ja_JP --output-file ja-JP/images/existing-setup-4.po
Created ja-JP/images/existing-setup-4.po.

その後翻訳。

$ vi ja-JP/images/existing-setup-4.po

翻訳結果を適用。差分を確認

$ po4a-translate --format dia --master en-US/images/existing-setup-4.xml --po ja-JP/images/existing-setup-4.po --keep 0 --localized ja-JP/images/existing-setup-4.xml
$ diff en-US/images/existing-setup-4.xml ja-JP/images/existing-setup-4.xml
89c89
<         <dia:string>#/usr/share/xbill/pixmaps/bsdcpu.xpm#</dia:string>
---
>         <dia:string>#../../en-US/images/bsdcpu.xpm#</dia:string>
115c115
<         <dia:string>#debian.xpm#</dia:string>
---
>         <dia:string>#../../en-US/images/debian.xpm#</dia:string>
142c142
<           <dia:string>#/gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
200c200
<           <dia:string>#/gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
258c258
<           <dia:string>#/gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
316c316
<           <dia:string>#/gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
374c374
<           <dia:string>#/gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>

diaでpngにエクスポート

$ dia --export ja-JP/images/existing-setup-4.png ja-JP/images/existing-setup-4.xml
ja-JP/images/existing-setup-4.xml --> ja-JP/images/existing-setup-4.png
$ gzip --verbose --stdout --best -- ja-JP/images/existing-setup-4.xml > ja-JP/images/existing-setup-4.dia
ja-JP/images/existing-setup-4.xml:       91.3%
$ gzip --verbose --list -- ja-JP/images/existing-setup-4.dia
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla 2bdd4d8d Apr 14 00:34                1655               18667  91.3% ja-JP/images/existing-setup-4.dia

pngもxmlも問題なさそう。

$ gzip --verbose --stdout --decompress -- en-US/images/autobuilder.dia > en-US/images/autobuilder.xml
en-US/images/autobuilder.dia:    92.8%
$ po4a-gettextize --format dia --master en-US/images/autobuilder.xml --po en-US/images/autobuilder.pot
$ msginit --no-translator --input en-US/images/autobuilder.pot --locale ja_JP --output-file ja-JP/images/autobuilder.po
Created ja-JP/images/autobuilder.po.
$ po4a-translate --format dia --master en-US/images/autobuilder.xml --po ja-JP/images/autobuilder.po --keep 0 --localized ja-JP/images/autobuilder.xml
$ diff en-US/images/autobuilder.xml ja-JP/images/autobuilder.xml
97c97
<             <dia:string>#Debian developer#</dia:string>
---
>             <dia:string>#Debian 開発者#</dia:string>
204c204
<               <dia:string>#Unstable#</dia:string>
---
>               <dia:string>#不安定版#</dia:string>
315c315
<             <dia:string>#Autobuilders#</dia:string>
---
>             <dia:string>#自動ビルドロボット#</dia:string>
385c385
<         <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>         <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
398,399c398,399
<             <dia:string>#binary packages
< i386, armel, powerpc#</dia:string>
---
>             <dia:string>#バイナリパッケージ
> i386、armel、powerpc#</dia:string>
445c445
<         <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>         <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
471c471
<         <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>         <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
541c541
<             <dia:string>#prepares#</dia:string>
---
>             <dia:string>#準備#</dia:string>
574,575c574,575
<             <dia:string>#built by the
< maintainer#</dia:string>
---
>             <dia:string>#メンテナに
> よるビルド#</dia:string>
608,609c608,609
<             <dia:string>#uploaded to the
< Debian server#</dia:string>
---
>             <dia:string>#Debian サーバ
> にアップロード#</dia:string>
656c656
<           <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
669c669
<               <dia:string>#source package#</dia:string>
---
>               <dia:string>#ソースパッケージ#</dia:string>
717c717
<           <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
730c730
<               <dia:string>#source package#</dia:string>
---
>               <dia:string>#ソースパッケージ#</dia:string>
778c778
<           <dia:string>#././gnome-mime-application-x-deb.png#</dia:string>
---
>           <dia:string>#../../en-US/images/gnome-mime-application-x-deb.png#</dia:string>
791c791
<               <dia:string>#amd64 binary packages#</dia:string>
---
>               <dia:string>#amd64 バイナリパッケージ#</dia:string>
$ dia --export ja-JP/images/autobuilder.png ja-JP/images/autobuilder.xml
ja-JP/images/autobuilder.xml --> ja-JP/images/autobuilder.png
$ gzip --verbose --stdout --best -- ja-JP/images/autobuilder.xml > ja-JP/images/autobuilder.dia
ja-JP/images/autobuilder.xml:    92.5%

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2008-08-16T13:15:42+09:00
  2. Modified: 2008-08-16T13:15:42+09:00
  3. Generated: 2024-11-18T23:09:11+09:00