get ready for full translated sites with entity translation
DESCRIPTION
Do you build multilingual websites with D7 and Content Translation today? Wanna build them tomorrow with Drupal 8? This session is for you. Even Entity Translation already exists in Drupal 7 for quite a while, it's not widely used yet, mostly for Commerce Product translations as it is pretty handy there. If it comes into nodes, Content Translation ist still the prefered system for most sites. In Drupal 8 there will be only one Translation System: Entity Translation. *oooh noo!* BUT! There is one really good thing about Entity Translation: It can be already fully used with Drupal 7, so the change from D7 to D8 will be much easier. Amazee Labs has already started to built Drupal 7 sites only with Entity Translation. It maybe sounds easy to translate a website only with Entity Translation, but there are quite some concepts which completely change. Like Menus, Entity References, Access Rights, Views, Fallbacks, and more. In this session I want to talk about the biggest learnings we had, what is easy and what is hard to build with Entity Translation, give advice what works well and what not. To make the transition from Content Translation to Entity Translation as easy as possible for everybody. For the full experience of the animated cat content gif goodness, you can download the Keynote slides at http://blog.amazeelabs.com/en/our-drupal-developer-days-szeged-slides.TRANSCRIPT
Full site translations with Entity Translation
Michael Schmid - @Schnitzel
First trials with Entity Translation
why Entity Translation?
• Allows things not possible via Content Translation
• Default in Drupal 8
$body['und'][0]['value'] = "Body";Can we use
that?
YES!
Entity Translation!
• uses Field Translations
• 1 Node for all languages
• changes concepts
Entity Translation
Content Translation
Node 1 Node 2
$language = "en";
$title = "Welcome";
$body['und'][0]['value'] = "Body";
$field_image['und'][0]['fid'] = 45;
$tnid = 1;
$language = "de";
$title = "Willkommen";
$body['und'][0]['value'] = "Körper";
$field_image['und'][0]['fid'] = 45;
$tnid = 1;
Node 1
$language = "en";
$title = "Welcome";
$body['en'][0]['value'] = "Body";$body['de'][0]['value'] = "Körper";
$field_image['und'][0]['fid'] = 45;
[#557292] Convert node title to fields
[#571654] Revert node titles as fields
[#557292] Convert node title to fields
title module
• https://drupal.org/project/title
• allows to replace title with title_field
• handles loading of right language
using Entity Translation
Content Translation
Content Translation
Entity Translation
Entity Translation
what to make translatable?
it depends!
what to make translatable
• Everything with Text
• others...
what languages are used for
• actual translation
• also different department informations
• US vs Europe Products
image fields?
• if image contains text
• or you need different images
list fields?
• to translate choices
• i18n field translations
• most probably not translatable
file fields?
• file probably contains text, so yes
entity reference fields?
• No, your referenced entity is translated again
• Use entityreference field!
Node 1
$body['en'][0]['value'] = "Body";$body['de'][0]['value'] = "Körper";
$field_image['und'][0]['target_id'] = 98;
entity reference fields
Node 98
$body['en'][0]['value'] = "Hello";$body['de'][0]['value'] = "Guten Tag";
Node 1
$body['en'][0]['value'] = "Body";$body['de'][0]['value'] = "Körper";
$field_image['en'][0]['target_id'] = 99;$field_image['de'][0]['target_id'] = 100;
entity reference fields
Node 99
$body['en'][0]['value'] = "Hello";$body['de'][0]['value'] = "Guten Tag";
Node 100
$body['en'][0]['value'] = "My Name is";$body['de'][0]['value'] = "Mein Name ist";
taxonomy fields?
•most probably not
•translated again
other entities?
file entity translation
• use file_entity module
• title and alt texts are fields
• make translatable
• file itself not translatable
taxonomy entity translation
• can also be translated with i18n_taxonomy
• don't do that anymore!
• now with entity translation
entity translation settings
original
translation
what to translate?
entity translation settings
upgrade!
Entity Translation Upgrade
Entity Translation Upgrade
• entity_translation_upgrade Module
1. make fields translatable!
2. replace title with title field
3. run upgrade
4. one Node will get field translations
5. other Nodes unpublished
Issues
Issues• Field Collections
• [#7735819]
• Views language filter
• Revisions
• Search API
• search_api_et module
Drupal 8
• no Content Translation like D7 anymore
• Entity Translation is called Content Translation
• every Entity is translated via Entity Translation
conclusion
conclusion
• start to use it
• think about what needs to be translatable
• upgrades: test, test, test
• you will still need i18n
Entity Translation <3
Demo