翻訳¶
Odoo を使用すると、別の言語にあなたのウェブサイトを翻訳できます。
この章では、以下の方法を学びます。
モジュールの内容を翻訳します。
翻訳のインポートとエクスポート
モジュールに翻訳を統合します。
Frontend¶
To translate your pages with the Website Builder, go to your website and click on the language selector to switch to it. If your website was never translated to the target language, click Add a language..., select it in the pop-up window, and click Add.
Translate をクリックして翻訳を開始します。 言語に応じて、一部のテキストは自動的に翻訳され、緑色でハイライトされますが、手動で翻訳する必要があるすべてが黄色でハイライトされます。

しかし、ウェブサイトビルダーを通じて何かを翻訳するときに、ボンネットの下で何が起こっているかを理解する必要があります。
デフォルトのページ¶
Odoo は、ウェブサイトがインストールされるとベースビューを作成します。 ビルダーを使用してページを編集する場合。 重複したビューが作成され、すべての変更がこのビュー(および翻訳も)に保存されます。 唯一の例外はホームページに関係しています(デフォルトでは、Odoo は編集する前にベースと複製されたビューを作成します)。

ソース言語で翻訳や変更を行う順番に注意することをお勧めします。 ウェブサイトビルダーを介してページを作成した場合、またはレコードがあるソースコードを介してページを作成した場合。 ソース言語 (Edit master
) の変更ごとに、ソース言語と既存の翻訳の間のリンクが壊れることに注意してください。 言い換えれば、翻訳元の言語を編集する場合は、翻訳を再作成する必要があります。
翻訳可能な文字列¶
t-att- / t-attf-¶
翻訳可能な文字列を設定したい場合は、可能な限り`t-att-`の代わりに`t-attf-`を使用してください。
例
「Hello username」と書くには、以下の方法で行うことができます。
<div t-attf-title="Hello #{user.name}" />
警告
下記の例のような t-att-title
でも同じ結果を得ることができます。ただし、結果は翻訳可能な文字列としてネイティブとはみなされません。
<div t-att-title="'Hello' + user.name" />
例外: t-value / t-valuef¶
`t-value`と`t-value`は少し違います。どれも明示的に変換可能なため、次のように書くことができます。
<t t-set=”additional_title”>My Page Title Shown in the Browser Tab</t>
XMLコンテキストを書いているので、2つのXMLタグの間にあるテキストは翻訳可能です。
翻訳可能と非翻訳可能を組み合わせています¶
1つの場所に翻訳可能なテキストを設定する必要がある場合:
<t t-set=”title”>Foo</t>
別の場所で呼び出す必要があります
<div t-att-title=”label” />
...
<nav t-att-title=”label” />
ここでは、翻訳可能なコンテンツを非翻訳可能な属性(t-att-title
)に呼び出しました。したがって、`t-att-title`は翻訳できませんが、キャストされた変数です。
バックエンド¶
Translating pages directly from the backend allows you to translate several languages at the same time. To do so, go to Edit Translations button.
, search for the name of the page you want to translate, and click the
エクスポート¶
Once you are done translating, you need to export the translations to integrate them into your module. To export everything at once, open your database, activate developer mode, and go to . Select the Language you translated, PO File under File Format, and website_airproof as the Apps To Export.
ファイルをダウンロードし、 i18n
フォルダに移動します。必要に応じて、あとで .po
ファイルを手動で編集できます。
PO ファイル¶
You can translate directly by editing a .po
file or creating the file yourself. Check out
the translating modules documentation to write your translations.
/website_coconuts/i18n/fr_BE.po
¶#. module: website_airproof
#: model_terms:ir.ui.view,arch_db:website_airproof.s_custom_snippet
msgid "..."
msgstr "..."
インポート¶
Odoo に翻訳ファイルをインポートするには、
に移動し、アップロードします。