drupalday - localizing drupal commerce
DESCRIPTION
Localizing Drupal Commerce un breve sguardo a come Drupal Commerce diventa multilingua Nella mia esperienza Drupal Commerce rappresenta uno strumento versatile per realizzare progetti e-commerce, riuscendo ad adattarsi a diversi tipi di business grazie alla sua gestione delle varianti di prodotto. Negli ultimi anni stiamo assistendo ad una continua crescita degli acquisti online e sempre più aziende italiane e non puntano alla domanda estera per accrescere il proprio fatturato. Quindi l’internazionalizzazione dell’e-commerce è diventata un’esigenza. Drupal Commerce è in grado di realizzare e-commerce multilingua e vari sono modi per poterlo fare. Con questo intervento voglio portare alla luce la prassi da me utilizzata per “internazionalizzare” Drupal Commerce attraverso l’utilizzo e la configurazione di moduli aggiuntivi (es. Entity Translation, Title). I partecipanti avranno quindi una traccia di come localizzare progetti e-commerce realizzati con Drupal e avere un motivo in più per credere che Drupal sia un framework eccellente per lo sviluppo di e-commerce. http://www.studioaqua.it/drupalday-milano-2014/TRANSCRIPT
Localizing Drupal Commercea brief glance to how Drupal Commerce become multilingual
ROBERTO PERUZZO
E [email protected] @robertoperuzzo W www.studioaqua.it In it.linkedin.com/in/robertoperuzzo
Software Developer
Drupal CommerceIs an Open Source eCommerce framework built from the ground up on Drupal 7.
Why Drupal Commerce• Mature project • Good documentation & community • Flexible & Extensible
Commerce GuysIs the company born from the Drupal community. It develops and supports the Drupal Commerce project.
Need help? Get help!• Guides [http://www.drupalcommerce.org/user-guide] • Videos [http://www.drupalcommerce.org/videos] • Inquiry [https://commerceguys.com/inquiry]
Store & Storehouse• How do you store? • How do you sell?
…Drupal Commerce doesn't care.
Product• Drupal entity • Define the product features
or product variation
Product page• Drupal node • Gathers product variations
or product display
Product Page & Product
Globalization• Internationalisation (i18n) • Localisation (L10n)
A big headache
translation entity_translation i18n_taxonomy
Product Page (node)
Product (entity)
Properties (taxonomy)
Elements
Modules
Take an aspirinProduct Page
(entity)Product
(entity)Property
(entity)
Elements
Modules
entity_translation +
title
entity_type = node entity_type = product entity_type = taxonomy_term
Modules for translation$drush dl entity_translation
$drush en entity_translation -y $drush dl title
$drush en title -y $drush dl variable
$drush en variable -y $drush dl i18n
$drush en i18n, i18n_translation, i18n_field, i18n_menu -y
Site configurations• Are your regional settings correct? • Add your language • Configure language detection • Import language files • Enable language selector for site visitors
Regional settings !
admin/config/regional/settings
Your language !
admin/config/regional/language
Language prefix
admin/config/regional/language/edit/en
Content language detection
admin/config/regional/language/configure
Content language detection URL
admin/config/regional/language/configure/url
Import language files
admin/config/regional/translate
Drupal core: https://localize.drupal.org/ Drupal Commerce: https://localize.drupal.org/translate/downloads?project=commerce
Import language files
admin/config/regional/translate/import
Enable language selector block
admin/structure/block
<?php!
! $block = module_invoke('locale', 'block_view', 'language');!
! print render($block['content']);!
?>
or through the code
Into block setting page
Configure translation• Select the translatable entity types • Enable field translation • Multilingual support for taxonomies • Set some sensible defaults
Select translatable entities
admin/config/regional/entity_translation
Field translation for content types
admin/structure/types/manage/<node-type-machine-name>
Replace title and enable fields translation
admin/structure/types/manage/<content-type-machine-name>/fileds
Convert the title into a translatable field
and edit each field you want to translate
Enable multilingual support for taxonomies
admin/structure/taxonomy/<vocabulary-name>/fields
Convert the name and description into a translatable field
and enable the translation
Set some sensible defaults
admin/config/regional/entity_translation
Translate content• Translate fields • Translate taxonomy items
Product creation (italian)
node/add/<content-type-name>
Product variation (italian)
node/add/<content-type-name>
Product translation (english)
node/<nid>/edit/add/it/en?destination=admin/commerce/products
Taxonomy translation (italian)
taxonomy/term/<tid>/edit/it
Taxonomy translation (english)
taxonomy/term/<tid>/edit/en