get ready for full translated sites with entity translation
Post on 08-May-2015
3.539 Views
Preview:
DESCRIPTION
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
top related