Get ready for full translated sites with Entity Translation
-
Upload
amazee-labs -
Category
Technology
-
view
3.539 -
download
0
description
Transcript of Get ready for full translated sites with Entity Translation
![Page 1: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/1.jpg)
Full site translations with Entity Translation
Michael Schmid - @Schnitzel
![Page 2: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/2.jpg)
First trials with Entity Translation
![Page 3: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/3.jpg)
why Entity Translation?
• Allows things not possible via Content Translation
• Default in Drupal 8
![Page 4: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/4.jpg)
$body['und'][0]['value'] = "Body";Can we use
that?
![Page 5: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/5.jpg)
YES!
![Page 6: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/6.jpg)
Entity Translation!
• uses Field Translations
• 1 Node for all languages
• changes concepts
![Page 7: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/7.jpg)
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;
![Page 8: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/8.jpg)
[#557292] Convert node title to fields
![Page 9: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/9.jpg)
[#571654] Revert node titles as fields
[#557292] Convert node title to fields
![Page 10: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/10.jpg)
title module
• https://drupal.org/project/title
• allows to replace title with title_field
• handles loading of right language
![Page 11: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/11.jpg)
using Entity Translation
Content Translation
Content Translation
Entity Translation
Entity Translation
![Page 12: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/12.jpg)
![Page 13: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/13.jpg)
what to make translatable?
![Page 14: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/14.jpg)
it depends!
![Page 15: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/15.jpg)
what to make translatable
• Everything with Text
• others...
![Page 16: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/16.jpg)
what languages are used for
• actual translation
• also different department informations
• US vs Europe Products
![Page 17: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/17.jpg)
image fields?
• if image contains text
• or you need different images
![Page 18: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/18.jpg)
list fields?
• to translate choices
• i18n field translations
• most probably not translatable
![Page 19: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/19.jpg)
file fields?
• file probably contains text, so yes
![Page 20: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/20.jpg)
entity reference fields?
• No, your referenced entity is translated again
• Use entityreference field!
![Page 21: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/21.jpg)
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";
![Page 22: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/22.jpg)
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";
![Page 23: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/23.jpg)
taxonomy fields?
•most probably not
•translated again
![Page 24: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/24.jpg)
other entities?
![Page 25: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/25.jpg)
file entity translation
• use file_entity module
• title and alt texts are fields
• make translatable
• file itself not translatable
![Page 26: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/26.jpg)
taxonomy entity translation
• can also be translated with i18n_taxonomy
• don't do that anymore!
• now with entity translation
![Page 27: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/27.jpg)
entity translation settings
![Page 28: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/28.jpg)
original
![Page 29: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/29.jpg)
translation
![Page 30: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/30.jpg)
what to translate?
![Page 31: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/31.jpg)
entity translation settings
![Page 32: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/32.jpg)
![Page 33: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/33.jpg)
upgrade!
![Page 34: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/34.jpg)
Entity Translation Upgrade
![Page 35: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/35.jpg)
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
![Page 36: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/36.jpg)
Issues
![Page 37: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/37.jpg)
Issues• Field Collections
• [#7735819]
• Views language filter
• Revisions
• Search API
• search_api_et module
![Page 38: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/38.jpg)
Drupal 8
• no Content Translation like D7 anymore
• Entity Translation is called Content Translation
• every Entity is translated via Entity Translation
![Page 39: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/39.jpg)
conclusion
![Page 40: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/40.jpg)
conclusion
• start to use it
• think about what needs to be translatable
• upgrades: test, test, test
• you will still need i18n
![Page 41: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/41.jpg)
Entity Translation <3
![Page 42: Get ready for full translated sites with Entity Translation](https://reader035.fdocuments.us/reader035/viewer/2022062513/554bb6a9b4c90530298b480c/html5/thumbnails/42.jpg)
Demo