drupal 8's multilingual apis: world · multilingual. interface interface translation has...
TRANSCRIPT
![Page 1: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/1.jpg)
![Page 2: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/2.jpg)
DRUPAL 8'S MULTILINGUAL APIS: BUILDING FOR THE ENTIRE
WORLD
![Page 3: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/3.jpg)
penyaskitoChristian López Espínola
Drupal 8 Multilingual Initiative contributor
![Page 4: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/4.jpg)
![Page 5: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/5.jpg)
![Page 6: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/6.jpg)
Drupal 7 MULTILINGUAL
![Page 7: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/7.jpg)
Drupal CORE
Drupal 7 MULTILINGUAL
![Page 8: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/8.jpg)
Drupal CORE
LOCALE
!
Drupal 7 MULTILINGUAL
![Page 9: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/9.jpg)
Drupal CORE
L10n UP
LOCALE
!
m
Drupal 7 MULTILINGUAL
![Page 10: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/10.jpg)
Drupal CORE
L10n UP
CONTENT TRANSLATION
LOCALE
!
Ü
m
Drupal 7 MULTILINGUAL
![Page 11: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/11.jpg)
Drupal CORE
L10n UP
CONTENT TRANSLATION
LOCALE
I18N !
!
Ü
m
Drupal 7 MULTILINGUAL
![Page 12: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/12.jpg)
Drupal CORE
L10n UP
CONTENT TRANSLATION
LOCALE
I18N
VARIABLE
"
!
!
Ü
m
Drupal 7 MULTILINGUAL
![Page 13: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/13.jpg)
Drupal CORE
L10n UP
CONTENT TRANSLATION
LOCALE
I18N
VARIABLE
Entity translation
#
"
!
!
Ü
m
Drupal 7 MULTILINGUAL
![Page 14: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/14.jpg)
Four pillars in Drupal 8
![Page 15: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/15.jpg)
LANGUAGE
Base services for all modules dealing
with data. Not just multilingual.
!
Four pillars in Drupal 8
![Page 16: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/16.jpg)
LANGUAGE
Base services for all modules dealing
with data. Not just multilingual.
INTERFACE
Interface translation has built-in update
feature, improved usability.
! 8
Four pillars in Drupal 8
![Page 17: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/17.jpg)
LANGUAGE
Base services for all modules dealing
with data. Not just multilingual.
INTERFACE
Interface translation has built-in update
feature, improved usability.
CONTENT
Field translation in built-in API for all entities. Content
translation module provides user
interface.
! 8 é
Four pillars in Drupal 8
![Page 18: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/18.jpg)
LANGUAGE
Base services for all modules dealing
with data. Not just multilingual.
INTERFACE
Interface translation has built-in update
feature, improved usability.
CONTENT
Field translation in built-in API for all entities. Content
translation module provides user
interface.
CONFIG
Common configuration
system handles blocks, views, field settings. Unified
translation.
(! 8 é
Four pillars in Drupal 8
![Page 19: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/19.jpg)
LANGUAGE INTERFACE CONTENT CONFIG
(! 8 é
Four pillars in Drupal 8
![Page 20: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/20.jpg)
DEALING WITH LANGUAGE
\Drupal:languageManager()
LanguageManager
![Page 21: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/21.jpg)
DEALING WITH LANGUAGE
\Drupal:languageManager()
LanguageManagerConfigurableLanguageManager
With language module enabled
![Page 22: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/22.jpg)
DEALING WITH LANGUAGE
->getLanguages()UND: NOT SPECIFIED
ZXX: NOT APPLICABLE
EN: ENGLISH (DEFAULT)
![Page 23: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/23.jpg)
UND: NOT SPECIFIED
ZXX: NOT APPLICABLE
HU: HUNGARIAN
IT: ITALIAN
DEALING WITH LANGUAGE
->getLanguages()
![Page 24: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/24.jpg)
UND: NOT SPECIFIED
ZXX: NOT APPLICABLE
HU: HUNGARIAN
IT: ITALIAN
language.entity.$langcode.yml
DEALING WITH LANGUAGE
->getLanguages()
![Page 25: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/25.jpg)
UND: NOT SPECIFIED
ZXX: NOT APPLICABLE
HU: HUNGARIAN
IT: ITALIAN
language.entity.$langcode.ymlLocked
DEALING WITH LANGUAGE
->getLanguages()
![Page 26: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/26.jpg)
UND: NOT SPECIFIED
ZXX: NOT APPLICABLE
HU: HUNGARIAN
IT: ITALIAN
language.entity.$langcode.ymlLocked Not locked
DEALING WITH LANGUAGE
->getLanguages()
![Page 27: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/27.jpg)
DEALING WITH LANGUAGE
ConfigurableLanguage::createFromLangcode(‘fr’)->save()
![Page 28: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/28.jpg)
DEALING WITH LANGUAGE
ConfigurableLanguage::load(‘fr’)->delete()
![Page 29: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/29.jpg)
DEALING WITH LANGUAGE
$languageManager->getCurrentLanguage()
![Page 30: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/30.jpg)
LANGUAGE INTERFACE CONTENT CONFIG
(! 8 é
Four pillars in Drupal 8
![Page 31: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/31.jpg)
INTERFACE LANGUAGE
![Page 32: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/32.jpg)
INTERFACE LANGUAGE
t(‘English text’)
![Page 33: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/33.jpg)
INTERFACE LANGUAGE
![Page 34: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/34.jpg)
DEPENDENCY INJECTION
LOGIC
TRANSLATION
CONFIGURATIONUSER
![Page 35: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/35.jpg)
DEPENDENCY INJECTION
LOGIC
TRANSLATION
CONFIGURATIONUSER
![Page 36: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/36.jpg)
INTERFACE LANGUAGE
t(‘English text’)
![Page 37: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/37.jpg)
INTERFACE LANGUAGE
t(‘English text’)$this->t(‘English text’)
![Page 38: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/38.jpg)
INTERFACE LANGUAGE
class Foo { use StringTranslationTrait; …
}
![Page 39: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/39.jpg)
INTERFACE LANGUAGE
![Page 40: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/40.jpg)
INTERFACE LANGUAGE
$this->t(‘English text’)->getOption(‘langcode’);
![Page 41: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/41.jpg)
INTERFACE LANGUAGE
format_plural(…)$this->formatPlural(…)
![Page 42: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/42.jpg)
Javascript api
Drupal.t(…)Drupal.formatPlural()
![Page 43: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/43.jpg)
TWIG TEMPLATES
<input {{ attributes }} placeholder="{{ 'Search'|trans }}" />
INPUT--SEARCH.HTML.TWIG
<div{{ author_attributes }}> {% trans %} Submitted by {{ author_name }} on {{ date }} {% endtrans %} </div>
NODE.HTML.TWIG
![Page 44: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/44.jpg)
LOCALE.links.menu.ymllocale.translate_page: title: 'User interface translation' description: 'Configure the import …’ route_name: locale.translate_page parent: system.admin_config_regional weight: 15 locale.translate_status: title: 'Available translation updates' route_name: locale.translate_status description: 'Get a status report …’ parent: system.admin_reports
![Page 45: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/45.jpg)
LOCALE.links.menu.ymllocale.translate_page: title: 'User interface translation' description: 'Configure the import …’ route_name: locale.translate_page parent: system.admin_config_regional weight: 15 locale.translate_status: title: 'Available translation updates' route_name: locale.translate_status description: 'Get a status report …’ parent: system.admin_reports
![Page 46: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/46.jpg)
LANGUAGE INTERFACE CONTENT CONFIG
(! 8 é
Four pillars in Drupal 8
English to X
![Page 47: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/47.jpg)
Node.php (Snippet)/** * Defines the node entity class. * * @ContentEntityType( * id = "node", * label = @Translation(“Content"), * translatable = TRUE, * entity_keys = { * "id" = "nid", * "label" = "title", * "langcode" = "langcode", * } * )
![Page 48: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/48.jpg)
contententitybase.php (Snippet)
function baseFieldDefinitions($entity_type) { // … if ($entity_type->hasKey('langcode')) { $fields[$entity_type->getKey('langcode')] =
BaseFieldDefinition::create('language') ->setLabel(new TranslatableMarkup('Language')) ->setDisplayOptions('view', [ 'type' => 'hidden', ])
}
}
![Page 49: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/49.jpg)
Node.php (Snippet)
function baseFieldDefinitions($entity_type) { $fields = parent::baseFieldDefinitions($entity_type); // … $fields['title'] = BaseFieldDefinition::create('string') ->setLabel(t('Title')) ->setRequired(TRUE) ->setTranslatable(TRUE);
}
![Page 50: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/50.jpg)
FIELDS THEMSELVES
![Page 51: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/51.jpg)
FIELDS THEMSELVES
AUTOMATED!
![Page 52: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/52.jpg)
MULTICOLUMN FIELD SNIPPET * @FieldType( * id = "image", * column_groups = { * "file" = { * "label" = @Translation("File"), * "columns" = { * "target_id", "width", "height" * }, * }, * "alt" = { * "label" = @Translation("Alt"), * "translatable" = TRUE * }, * }
![Page 53: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/53.jpg)
Entity language API$node = Node::load(42);
$node = $node ->getTranslation(‘hu’);
$node = $entityRepository ->getTranslationFromContext($node);
![Page 54: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/54.jpg)
Entity language API$node->getUntranslated()
$node->language()
$node->getTranslationLanguages()
$node->hasTranslation(‘hu’)
$node->addTranslation(‘hu’)
$node->removeTranslation(‘hu’)
![Page 55: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/55.jpg)
Views ALL the things
![Page 56: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/56.jpg)
LANGUAGE INTERFACE CONTENT CONFIG
(! 8 é
Four pillars in Drupal 8
English to X X to Y
Intelligent objects
![Page 57: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/57.jpg)
config/install/system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
![Page 58: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/58.jpg)
Core.data_types.schema.yml
config_object: type: mapping mapping: langcode: type: string label: 'Language code' …
text: type: string label: 'Text' translatable: true
![Page 59: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/59.jpg)
config/schema/system.schema.yml
system.maintenance: type: config_object label: 'Maintenance mode' mapping: message: type: text label: 'Message to display…’
LANGCODE
TRANSLATABLE STRING
![Page 60: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/60.jpg)
system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
![Page 61: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/61.jpg)
system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
LANGUAGES/HU/SYSTEM.…YML
![Page 62: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/62.jpg)
system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
LANGUAGES/HU/SYSTEM.…YML
message: '@site karbantartás alatt áll…’
![Page 63: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/63.jpg)
system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
LANGUAGES/HU/SYSTEM.…YML
message: '@site karbantartás alatt áll…’
LANGUAGES/IT/SYSTEM.…YML
![Page 64: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/64.jpg)
system.maintenance.yml
message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.' langcode: en
LANGUAGES/HU/SYSTEM.…YML
message: '@site karbantartás alatt áll…’
LANGUAGES/IT/SYSTEM.…YML
message: '@site …’
![Page 65: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/65.jpg)
configuration API
$config = \Drupal::config(‘system.maintenance’);
$config->get(‘message’);
![Page 66: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/66.jpg)
configuration API
$config = \Drupal::config(‘system.maintenance’);
$config->get(‘message’);
OVERRIDES APPLY AS
APPROPRIATE
![Page 67: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/67.jpg)
configuration API
$manager = \Drupal::languageManager(); $hu = $manager->getLanguage('hu');
$original = $manager->getConfigOverrideLanguage(); $manager->setConfigOverrideLanguage($hu);
$config = \Drupal::config(‘system.maintenance'); // …
$manager->setConfigOverrideLanguage($original);
![Page 68: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/68.jpg)
configuration API\Drupal::config(‘system.maintenance’);
\Drupal::configFactory()->getEditable(‘system.maintenance’);
\Drupal::languageManager() ->getLanguageConfigOverride ('hu', 'system.maintenance') ->set('message', 'Karbantartás...') ->save();
OVERRIDES APPLY AS
APPROPRIATE
NO OVERRIDES APPLY
THE OVERRIDE
ITSELF
![Page 69: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/69.jpg)
LANGUAGE INTERFACE CONTENT CONFIG
(! 8 é
Four pillars in Drupal 8
English to X X to Y
Intelligent objects
X to Y
Dumb arrays
![Page 70: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/70.jpg)
![Page 71: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/71.jpg)
![Page 72: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/72.jpg)
Gábor hojtsyGábor Hojtsy
Drupal 8 Multilingual Initiative lead
![Page 73: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/73.jpg)
JOIN US FORCONTRIBUTION SPRINTS
First Time Sprinter Workshop - 9:00-12:00 - Room Wicklow2AMentored Core Sprint - 9:00-18:00 - Wicklow Hall 2BGeneral Sprints - 9:00 - 18:00 - Wicklow Hall 2A
![Page 74: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/74.jpg)
DRUPAL 8'S MULTILINGUAL APIS: BUILDING FOR THE ENTIRE
WORLD
![Page 75: DRUPAL 8'S MULTILINGUAL APIS: WORLD · multilingual. INTERFACE Interface translation has built-in update feature, improved usability. CONTENT Field translation in built-in API for](https://reader033.vdocuments.site/reader033/viewer/2022051823/5fed7b087bc8d073d42a209a/html5/thumbnails/75.jpg)
Evaluate This Session
THANK YOU!
events.drupal.org/dublin2016/schedule
WHAT DID YOU THINK?