GNU gettext PO(ポータブル オブジェクト)¶
Libre ソフトウェア(自由ソフトウェア)の翻訳に最も広く使用されているフォーマット。
ファイルに保存されている付随情報は、ヘッダーを調整するか、対応する原文にリンクして対応します。
参考
原文の変更の表示¶
Weblate は、PO ファイルに以前のソース文字列が存在する場合、それを抽出して、編集が必要な文字列の差異を表示できます。この機能を利用するには、msgmerge を --previous オプション付きで実行し、生成された PO ファイルに以下のような行を含めることが必要です:
#, fuzzy
#| msgid "previous-untranslated-string"
msgid "untranslated-string"
msgstr "translated-string"
This is controlled by the po_keep_previous ファイル形式パラメータ
parameter. It does not affect obsolete entries marked with #~.
Obsolete strings¶
msgmerge keeps strings removed from the POT file as obsolete #~
entries by default. Enable the po_remove_obsolete ファイル形式パラメータ
parameter to remove obsolete entries when Weblate saves PO files.
PO ファイル ヘッダー¶
The header of the PO file is automatically maintained by Weblate.
It can be configured to include the Language-Team, Last-Translator,
X-Generator and Report-Msgid-Bugs-To headers using the ファイル形式パラメータ.
Contributor comments¶
Use the po_contributor_comments ファイル形式パラメータ parameter to add
contributor names and years to PO header comments. Choose gettext for
traditional comments or spdx for SPDX copyright entries. The default,
none, disables contributor updates without removing existing comments.
This setting works independently of the Last-Translator header setting.
With gettext, contributor comments look like this:
# Jane Doe <jane@example.com>, 2024, 2026.
With spdx, the same entry becomes:
# SPDX-FileCopyrightText: 2024, 2026 Jane Doe <jane@example.com>
On the next commit by an eligible contributor, SPDX mode converts all recognized contributor comments, preserves historical contribution years, and adds the current year for that contributor. Anonymous Weblate authors are skipped. Unrelated comments and copyright notices are preserved. Weblate does not infer copyright claims from translated credit strings or add project-specific notices or license identifiers; handle these in custom tooling.
行の折り返し¶
行折り返しは主に GNU gettext の動作に準拠しています。ただし、GNU gettext の折り返しアルゴリズムや、その基盤となる Unicode データは随時更新されるため、一部の特殊なケースでは違いが生じることがあります。
折り返し幅は po_line_wrap パラメーターで設定できます。参照: ファイル形式パラメータ。
対応する MO ファイルの生成¶
MO ファイルを PO ファイルと一緒にリポジトリに保持している場合は、MO ファイルの生成 を使用して、MO ファイルを PO ファイルに合わせて最新の状態に保つことができます。
POT ファイルから PO ファイルを更新する¶
POT に合わせて PO ファイルを更新 (msgmerge) を使用すると、POT ファイルから PO ファイルを更新できます。参照: 翻訳対象の言語ファイルの更新。
モノリンガルの gettext¶
一部のプロジェクトでは、gettext をモノリンガル形式として使用することを定めています。ソースコード内の ID のみをコード化し、文字列を英語を含むすべての言語に翻訳することが必要です。これには対応していますが、コンポーネントを Weblate にインポートするときは、このファイル形式を明示的に選択することが必要です。
ファイルの例¶
一般的なバイリンガルの gettext PO ファイル:
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Monday"
msgstr "Pondělí"
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Tuesday"
msgstr "Úterý"
#: weblate/accounts/avatar.py:163
msgctxt "No known user"
msgid "None"
msgstr "Žádný"
一般的なモノリンガルの gettext PO ファイル:
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Pondělí"
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Úterý"
#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "Žádný"
一般的な基礎となる言語ファイル:
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Monday"
#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Tuesday"
#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "None"
File extensions |
|
|---|---|
Linguality ⓘ |
Monolingual |
Supports plural ⓘ |
|
Supports descriptions ⓘ |
|
Supports explanation ⓘ |
|
Supports context ⓘ |
|
Supports location ⓘ |
|
Supports flags ⓘ |
|
Additional states ⓘ |
|
API identifier |
|
Supports read-only strings ⓘ |
|
Supports removing obsolete strings ⓘ |
|
File extensions |
|
|---|---|
Linguality ⓘ |
Bilingual |
Supports plural ⓘ |
|
Supports descriptions ⓘ |
|
Supports explanation ⓘ |
|
Supports context ⓘ |
|
Supports location ⓘ |
|
Supports flags ⓘ |
|
Additional states ⓘ |
|
API identifier |
|
Supports read-only strings ⓘ |
|
Supports removing obsolete strings ⓘ |
|
Weblate の設定¶
バイリンガル gettext 用の、標準的な Weblate コンポーネント構成 |
|
|---|---|
ファイル マスク |
|
モノリンガル用の、基礎となる言語ファイル |
Empty(空) |
新しい翻訳のテンプレート |
|
ファイル形式 |
Gettext PO ファイル |
モノリンガル gettext 用の、標準的な Weblate コンポーネント構成 |
|
|---|---|
ファイル マスク |
|
モノリンガル用の、基礎となる言語ファイル |
|
新しい翻訳のテンプレート |
|
ファイル形式 |
gettext PO ファイル (モノリンガル) |
ファイル形式パラメータ¶
po_* パターンを持つ ファイル形式パラメータ を使用すると、gettext 形式の動作を設定できます。