Configure entity translation for Drupal Commerce
This documentation page is based on an extensive comment by j2b. Needs rewording and style review. Will need updating once the commerce patch in #1495570: Update Entity translation integration is committed.
Basis
At the time of writing the Drupal Commerce Kickstart distribution (dev 2.x) does not work properly with Entity Translation. This document was created with the help of a clean copy of Commerce and the following modules: Search API, Facet API, Views, Entity, Commerce, Entity Translation, i18n. The Entity Cache was not installed. (@todo why?)
Read moreTranslate several entities at once
Analog to 'Node Source' there is an 'Entity Sources' listing on which you can manage bulk translation with entities.
Go to Administration > Configuration > Regional and language > Translation Management > Entity Sources. Here you can access all entity types that have been marked as translatable. In the case below 'Comment' and 'Node'.
In this case we want to translate entites with 2 different source languages. Therefore 2 seperate jobs will be created. The need to be submitted to translator in sequence. With the first job the the button will say 'Submit to translator and continue' to indicate that there are more jobs to take care of.
The rest of the process works the same as in the previous cases.
Entity Translation
Instead of translating complete nodes it can be interesting to make only some fields of a node translatable. This can be achieved by using the Entity Translation Module (http://drupal.org/project/entity_translation). With it, fieldable entities can be translated without doubling the node itself.
Make entities translatable
As a starting step make sure that you have set the appropriate options for language detection (Administration > Configuration > Regional and language > Languages, choose the 'Detection and selection' tab). This will facilitate finding the translations once they are done.
- Download and activate the entity_translation module
- Create a content type with the fields you want to translate
- Under the publishing option of the type choose 'Enabled, with field translation' in Mulitlingual support
- In the properties of each field enable the field translation ('Users may translate this field'). You will find this in the 'edit' tab
Fields can now be translated one by one. For a more detailed description see this post by Randy Fay.
Invoke TMGMT
Translating content
Drupal provides two methods for translating site content:
- Content translation and
- Entity translation
Any site can use both methods as long as the relevant modules are enabled: Content Translation (core) and Entity Translation (Drupal 7 contrib, Drupal 8 core). The method of multilingual support can then be configured for each content type. In other words, you can use Content Translation for some content types and Entity Translation for others.
The Content Translation module allows nodes to be translated by creating a set of nodes which are translations of each other (i.e., a node translation set). By contrast, the Entity Translation module allows particular fields to be translated, while only a single node or entity is created. With Entity Translation, the entity is language-independent. Only the associated fields are flagged with a language.
Other content
For information about translating HTML5 subtitles, see How to Build a Drupal 7 HTML5 Video Subtitling/Closed-captioning System.
Configure Views for entity-translated content
Views can display entity-translated content (nodes) with the following steps:
- Edit view
- Click on Advanced
- Click on Current user's language for Field Language in the Other section
- Check When needed, add the field language condition to the query checkbox
- Click Apply
- Save view
Remember the title_field (from the Title module) should be used if we use fields in our view (there is a content title field and a title_field to select to be displayed). Unfortunately, both of these show up as "Content: Title" when adding fields. The one that has the description "The content title." is the regular title, so choose the other field instead.
If we want the view to only display content of one language (depending on the language detection rules), then we need to disable the Enable language fallback in the Configuration > Regional and language > Entity translation (admin/config/regional/entity_translation) settings.
Note: Currently, there is a pitfall when one does not have all nodes translated in all languages and results can get a little mixed up #1330332: Entity translation: Views field language filter.
Read moreTranslate content with entity translation
Once entity translation has been enabled for a content type or entity type, the interface for translating that content will be available through a Translate tab that appears for each piece of content. For example, if the user entity type has entity translation enabled, a Translate tab will be available when viewing the user. If the article content type has entity translation enabled, a Translate tab will be added to each article node.
The Translate tab provides a table showing which translations have been added, allowing you to add translations and edit existing translations. The language in which content was initially written is called the source language, and the content added in that language is marked as the original content. Editing the item marked original content will give you access to edit all the language-independent fields and elements related to the entity, as well as the translatable fields in the source language. Editing translations in other languages will only give you access to translate the translatable fields for that entity.
