Site Overlay

Language Localization in Tryton

Languages generally available on the system

The first thing you have to specify is what languages should be available on the system as such. “Available” in this context has a broader meaning beyond the UI dialog languages. Among other things, it also includes the option to let product names appear in different languages. Suppose that you have set up a product “beanie”. What is a beanie to an English speaking system user is a “bonnet” for a French speaking system user (or customer, for that matter). So Languages covers anything where different languages come into place:

  • The UI language depending on the language preferences of the user
  • The language for any database items such as product descriptions, units of measurement
  • The language of documents and document templates for customer invoices, accounting reports like balance sheets or VAT recordings submitted to national authorities etc.

Go to Administration / Localization / Languages and tick the Translatable boxes for any language you want the system to cover.

Default language when a new party is set up

In the general Parties / Configuration section, there is a field Party Language which is the default language for any new party when it is set up:

Party specific language preference

To set the individual language preference of the Tryton party, click Parties / Parties in the menu section and open the Parties tab (either by clicking an existing party from the list or adding a new party). In the General tab you can pick a Language for that party.

Translation of database items

The term “database items” refers to anything translatable that has been entered as “static data” by the users with adminstration privileges into the database (e.g. product descriptions, country names, template texts) and is not already included in the default installation of Tryton (e.g. UI labels).

Imagine that our company trades beanies. To capture (and process) the purchases and sales of beanies we first need to create a product “Beanie” in the database. An English speaking user with administrative rights would set it up as follows:

An English speaking product administrator of Python setting up a product with an English product name

Now let’s assume that a French speaking user logs in. The user would expect to see the French word “bonnet” as the product name but will see the same English name “Beanie” in his otherwise French UI. Likewise, the term “Beanie” would also appear in French document templates for invoices, reports etc.

Product as seen on the UI of a user with language prefrences set to French

We would prefer that the product name also appears in French (i.e. “bonnet”) when a Tryton user with French language preferences is logged in. Tryton allows this by the means of Local Translations.

Local Translations

Here’s how to provide translations for product names to Tryton: Select Adminstrations / Localization / Translations from the menu. Here’s the window that pops up:

Translations initial window

The list of translations first shows the UI translations under the Modules Tab. These are mainly labels on UI input screens.

If you change to the Local tab you will see translations for static data that you put into the database. In our case we loaded country names into the database when activating the country module, so we should not be surprised to find a list with country names.

Enter the term “Beanie” in the Search bar, and you will get the following result:

When we click the Plus button to create a new record a new line is added to the list. We enter the term Beanie as Source, Bonnet as Translation Value and select French as the Language. After that we click the Save button just to get the following – rather cryptic – error message:

Error message when trying to add a translation

The problem is there is no field Type which we could populate. The reason is that Tryton’s default view of the list hides some columns. If you click on the 3 little blue horizontal lines left of the Source column, a list with hidden columns opens. Check the Type, Field Name and Resource ID entries to unhide the columns in the list.

Unhiding columns in the Translations list

You can now populate the empty fields in the row with the Bonnet translation:

  • Add product.template,name as Field Name
  • Select Model in the Type field
  • Carry over the Resource ID from the row with the original entry into the translation
  • Then click the Save button of the dialog

Let’s assume we also have a German speaking operator who would expect the German word “Mütze” instead of Beanie or Bonnet as the product name. We add a third record with a German translation. This time we take a shortcut by just duplicating one the existing Beanie translation rows:

  • Select the original English Beanie row
  • Then click on the chevron next to the Adminstration / Localization / Translations title of the window
  • Select Duplicate from the drop-down menu that opens
  • In the duplicated row change the Translation Value to Mütze and select German in the Language field
  • Click the Save button.

Here’s the final result:

Product name translation added in Local Translations

Let’s now confirm that a user with language preference with set to French will see the product as “Bonnet” instead of “Beanie” on their UI:

Translated product name showing up for a user with French language preference