po ファイルで翻訳管理

27
PO ファイルで翻訳管理 Powered by Rabbit 0.9.2 PO ファイルで翻 訳管理 倉澤 望 (鍋太郎) @nabetaro

Upload: nozomu-kurasawa

Post on 12-Jul-2015

3.259 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

PO ファイルで翻訳管理

倉澤 望 (鍋太郎) @nabetaro

Page 2: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

自己紹介

プログラマー✓

Debian JP✓

長野ソフトウェアエンジニアグループ (NSEG)

1/26

Page 3: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

自己紹介

Debian JP で文書翻訳インストールマニュアル✓

po4a, apt, etc✓

TortoiseSVN のヘルプ翻訳(休止)

2/26

Page 4: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

ドキュメントの翻訳

訳すのは時間がかかる✓

でも保守が要らなければ、そんなにつらくない

保守しなければならないと……?

3/26

Page 5: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

ドキュメントの翻訳保守

保守し続けるのは大変✓

終わらない✓

追いつかないと、悲しいことに✓

4/26

Page 6: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

悲しいことの例

某 Linux ディストリビューションの最新開発版のSSを例示

特定のプロダクトをdisる意図はありません

5/26

Page 7: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

悲しいことの例 (日本語)

6/26

Page 8: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

悲しいことの例 (原文)

7/26

Page 9: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

追いつかないと

古いままになる✓

最新のプログラムの挙動を説明していない

結果的に「嘘」になる✓

8/26

Page 10: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳が追いつかないなら

原文の方が「嘘」の翻訳よりは、ましじゃないか?

そんな仕組みはないかな?✓

...✓

9/26

Page 11: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳が追いつかないなら

原文の方が「嘘」の翻訳よりは、ましじゃないか?

そんな仕組みはないかな?✓

...ある✓

10/26

Page 12: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

GetText の PO ファイルGNU GetText では、未訳の部分は自動で原文 (msgid) になる

これをドキュメントに応用✓

既存の PO ファイル翻訳支援ツールが使える

11/26

Page 13: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

ドキュメントの翻訳にPOを使用するツール

xml2po (gnome由来)✓

po2xml (kde由来)✓

対象はDocBook(XML)のみ?

12/26

Page 14: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

Po4a (Po for anything)

各種ドキュメントで po ファイルを使用するツール群

http://po4a.alioth.debian.org/

13/26

Page 15: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

Po4a (Po for anything)ドキュメントから文字列抽出→ po ファイル生成

poファイルから、ドキュメントに翻訳文字列挿入

翻訳時に追加内容テキスト挿入✓

上記の複数ファイル一括処理✓

etc.✓ 14/26

Page 16: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

対応フォーマット

- dia: 非圧縮 Dia ダイアグラム。- docbook: DocBook XML。- guide: Gentoo Linux の XML ドキュメントフォーマット。- ini: .INI フォーマット。- kernelhelp: 各カーネルのコンパイルオプションのヘルプメッセージ。- latex: LaTeX フォーマット。- man: 古き良きマニュアルページフォーマット。- pod: Perl オンラインドキュメントフォーマット。- sgml: DebianDoc DTD と DocBook DTD。- texinfo: info ページフォーマット。- tex: 汎用 TeX ドキュメント (latex が参照)。- text: シンプルなテキストフォーマット。(fortunes, markdown, asciidoc)- wml: WML ドキュメント。- xhtml: XHTML ドキュメント。- xml: 汎用 XML ドキュメント (docbook が参照)。

15/26

Page 17: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳のフロー(po化)

16/26

Page 18: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳のフロー(更新)

17/26

Page 19: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳のフロー(翻訳生成)

18/26

Page 20: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳のフロー

以上を、ファイルごとに行う✓

めんどくさい✓

Makefile 書く?✓

19/26

Page 21: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

一括でやる方法

po4a コマンド✓

設定ファイルで一括処理✓

20/26

Page 22: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

po4a コマンドのフロー

21/26

Page 23: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

設定ファイルの例

# location of pot and po[po_directory] po

# Entities need to be present, even if not translated[po4a_alias:entity] text opt:"-k 0"

# define source file and translated file (one file per line)[type: man] apt.8 $lang:$lang/apt.$lang.8[type: entity] apt.ent $lang:$lang/apt.ent[type: docbook] apt-cache.8.xml $lang:$lang/apt-cache.$lang.8.xml add_$lang:xml.add[type: docbook] apt-cdrom.8.xml $lang:$lang/apt-cdrom.$lang.8.xml add_$lang:xml.add[type: docbook] apt-config.8.xml $lang:$lang/apt-config.$lang.8.xml add_$lang:xml.add

22/26

Page 24: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

設定の基本

[po4a_alias:エイリアス] 形式 オプションなど[type: 形式] 原文ファイル 生成する翻訳ファイル 追加内容ファイル...

$lang は 各言語コードに展開✓

エイリアスを設定して、それを形式として扱う

23/26

Page 25: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

翻訳の位置

po_directory で POTファイル、POファイルの位置指定

言語コード.po が翻訳対象✓

新言語の追加は POファイルを置くだけ

24/26

Page 26: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

おわりに

xmlだけじゃない✓

特に manpage には便利✓

問題はなくはないが、今のところ使いやすい

25/26

Page 27: PO ファイルで翻訳管理

PO ファイルで翻訳管理 Powered by Rabbit 0.9.2

おまけ

xml の階層はプレースホルダとしておける

#. type: Content of: <refentry><refsect1><para>#: apt-ftparchive.1.xml:612msgid """To create a compressed Packages file for a directory containing binary ""packages (.deb): <placeholder type=\"programlisting\" id=\"0\"/>"msgstr """バイナリパッケージ (.deb) があるディレクトリの Packages ファイルを生成するに""は、以下のようにします。<placeholder type=\"programlisting\" id=\"0\"/>"

26/26