Fordítások

Az Odoo segítségével weboldalát különböző nyelvekre fordíthatja.

Ebben a fejezetben megtanulja, hogyan kell:

  • Fordítsa le egy modul tartalmát.

  • Fordítások importálása és exportálása.

  • Fordítások integrálása egy modulba.

Előtér

A Website Builder segítségével történő oldalak fordításához lépjen a weboldalára, és kattintson a nyelvválasztóra a váltáshoz. Ha a weboldalát még soha nem fordították le a célnyelvre, kattintson a Nyelv hozzáadása… gombra, válassza ki a felugró ablakban, majd kattintson a Hozzáadás gombra.

Kattintson a Fordítás gombra a fordítás megkezdéséhez. A nyelvtől függően néhány szöveg automatikusan lefordításra kerül és zölddel kiemelve jelenik meg, míg minden, amit manuálisan kell fordítani, sárgával van kiemelve.

Fordítás gomb

However, you have to understand what’s happening under the hood when you translate something through the Website Builder.

Alapértelmezett oldalak

Odoo creates a base view once the Website is installed. If you edit the page with the Builder, a duplicated view will be created and all your modifications will be saved into this one (and your translations also). The only exception concerns the homepage (by default, Odoo creates a base and duplicated view even before you’ve edited anything).

Translations dupliclated page

We recommend to be very careful about the order in which you will carry out translations or modifications in the source language, either if you created the page through the Website Builder or through the source code with a record. Note that every single modification of the source language (Edit master) will break the link between the source language and the existing translations. In other words, you’ll have to re-create the translations if you edit the source language.

Translatable strings

t-att- / t-attf-

If you want to set a translatable string, use preferably t-attf- instead of t-att- whenever possible.

Example

To write “Hello username”, you can do it in the following way:

<div t-attf-title="Hello #{user.name}" />

Figyelem

You could also achieve the same result with an t-att-title like the example below. However, the result won’t be considered natively as a translatable string:

<div t-att-title="'Hello' + user.name" />

Exception: t-value / t-valuef

t-value and t-valuef are a bit different. None of them are explicitly translatable, so you could write something like this:

<t t-set=”additional_title”>My Page Title Shown in the Browser Tab</t>

As we are writing XML context, text located between two XML tags are translatable.

Mixing translatable and non-translatable

In a situation where we need to set a translatable text in only one single place:

<t t-set=”title”>Foo</t>

And then we need to call it in different locations:

<div t-att-title=”label” />
...
<nav t-att-title=”label” />

Here we just called the translatable content into a non-translatable attribute (t-att-title). So the t-att-title is not translatable but the casted variable is.

Háttér

Az oldalak közvetlen fordítása a háttérből lehetővé teszi, hogy egyszerre több nyelvet is lefordítson. Ehhez lépjen a Beállítások ‣ Technikai ‣ Felhasználói felület: Nézetek menüpontra, keresse meg a fordítani kívánt oldal nevét, és kattintson a Fordítások szerkesztése gombra.

Fordítások szerkesztése

Exportálás

Miután befejezte a fordítást, exportálnia kell a fordításokat, hogy integrálhassa azokat a moduljába. Az összes egyszerre történő exportálásához nyissa meg az adatbázisát, aktiválja a fejlesztői módot, és lépjen a Beállítások ‣ Fordítások ‣ Fordítás exportálása menüpontra. Válassza ki a lefordított Nyelvet, a PO fájlt a Fájlformátum alatt, és a website_airproof-ot az Exportálandó alkalmazások mezőben.

Töltse le a fájlt, és helyezze át az i18n mappába. Ha szükséges, utólag manuálisan is szerkesztheti az .po fájlt.

PO fájl

Közvetlenül is fordíthat egy .po fájl szerkesztésével vagy a fájl saját kezű létrehozásával. Nézze meg a modulok fordításának dokumentációját, hogy megírhassa a fordításait.

/website_coconuts/i18n/fr_BE.po
#. module: website_airproof
#: model_terms:ir.ui.view,arch_db:website_airproof.s_custom_snippet
msgid "..."
msgstr "..."

Importálás

A fordítási fájlok Odoo-ba történő importálásához lépjen a következőhöz: Beállítások ‣ Fordítások ‣ Fordítás importálása és töltse fel azokat.