get ready for full translated sites with entity translation

42
Full site translations with Entity Translation Michael Schmid - @Schnitzel

Upload: amazee-labs

Post on 08-May-2015

3.539 views

Category:

Technology


0 download

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

Page 1: Get ready for full translated sites with Entity Translation

Full site translations with Entity Translation

Michael Schmid - @Schnitzel

Page 2: Get ready for full translated sites with Entity Translation

First trials with Entity Translation

Page 3: Get ready for full translated sites with Entity Translation

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

$body['und'][0]['value'] = "Body";Can we use

that?

Page 5: Get ready for full translated sites with Entity Translation

YES!

Page 6: Get ready for full translated sites with Entity Translation

Entity Translation!

• uses Field Translations

• 1 Node for all languages

• changes concepts

Page 7: Get ready for full translated sites with Entity Translation

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

[#557292] Convert node title to fields

Page 9: Get ready for full translated sites with Entity Translation

[#571654] Revert node titles as fields

[#557292] Convert node title to fields

Page 10: Get ready for full translated sites with Entity Translation

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

using Entity Translation

Content Translation

Content Translation

Entity Translation

Entity Translation

Page 12: Get ready for full translated sites with Entity Translation
Page 13: Get ready for full translated sites with Entity Translation

what to make translatable?

Page 14: Get ready for full translated sites with Entity Translation

it depends!

Page 15: Get ready for full translated sites with Entity Translation

what to make translatable

• Everything with Text

• others...

Page 16: Get ready for full translated sites with Entity Translation

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

image fields?

• if image contains text

• or you need different images

Page 18: Get ready for full translated sites with Entity Translation

list fields?

• to translate choices

• i18n field translations

• most probably not translatable

Page 19: Get ready for full translated sites with Entity Translation

file fields?

• file probably contains text, so yes

Page 20: Get ready for full translated sites with Entity Translation

entity reference fields?

• No, your referenced entity is translated again

• Use entityreference field!

Page 21: Get ready for full translated sites with Entity Translation

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

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

taxonomy fields?

•most probably not

•translated again

Page 24: Get ready for full translated sites with Entity Translation

other entities?

Page 25: Get ready for full translated sites with Entity Translation

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

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

entity translation settings

Page 28: Get ready for full translated sites with Entity Translation

original

Page 29: Get ready for full translated sites with Entity Translation

translation

Page 30: Get ready for full translated sites with Entity Translation

what to translate?

Page 31: Get ready for full translated sites with Entity Translation

entity translation settings

Page 32: Get ready for full translated sites with Entity Translation
Page 33: Get ready for full translated sites with Entity Translation

upgrade!

Page 34: Get ready for full translated sites with Entity Translation

Entity Translation Upgrade

Page 35: Get ready for full translated sites with Entity Translation

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

Issues

Page 37: Get ready for full translated sites with Entity Translation

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

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

conclusion

Page 40: Get ready for full translated sites with Entity Translation

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

Entity Translation <3

Page 42: Get ready for full translated sites with Entity Translation

Demo