Creating a Multilingual Install Profile for Drupal
-
Upload
suzanne-dergacheva -
Category
Technology
-
view
307 -
download
0
Transcript of Creating a Multilingual Install Profile for Drupal
CREATING A MULTILINGUAL INSTALL PROFILE
Drupal Consulting, Development, and Training evolvingweb.ca
Suzanne Dergacheva, Co-founder @suzanne_kennedy
TRAINING PROGRAMevolvingweb.ca/training
!
MAKING A MULTILINGUAL WEBSITE - CHECKLIST
MULTILINGUAL CHECKLIST• Enable some modules
• Add languages
• Set up language negotiation
• Pull in languages from localize.drupal.org
• Turn on the language switcher
MULTILINGUAL CHECKLIST• Enable field-level translation for content types
• Add variable translations
• Enable translation for the main menu
• Set the language of menu items
• Setup pathauto patterns for each language
Configuration > Regional & language > Languages
Installing Languages
Language Detection & Selection
Using the URL as the primary method of language detection
Localization Update
drupal.org/project/l10n_update
Switching Languages
Setting up Field Translation
Translating Variables
Translating Menus
Pathauto PatternsCreate a pathauto pattern per language
HOW TO SCRIPT THIS?
• Create a post-install script - using drush commands and php scripts
• Create an install profile
• Create an install profile, with make files
WHAT’S IN THE SCRIPT?drush en admin_menu admin_menu_toolbar locale l10n_update entity_translation -y
drush variable-realm-set language en site_name "Multilingual Drupal”
drush scr create-menu-items.script
drush vset language_content_type_article 4
drush l10n-update
INSTALL PROFILE
RUNNING THE INSTALL PROFILE
RUNNING THE INSTALL PROFILE
DEMO!
.INFO FILEname = Multilingual Startkerkit
description = Profile for setting up a multilingual website.
core = 7.x
version = 0.1
!
;Core Dependencies
dependencies[] = block
dependencies[] = color
dependencies[] = comment
.INSTALL FILE• hook_install
• add text formats
• enable blocks
• add node types
• set variables
• create fields and field instances
.PROFILE FILE• hook_install_tasks
• array of steps for the installer
• each step corresponds to a callback function (could be a form)
• hook_install_tasks_alter
• you can unset steps in the default process
INSTALLATION STEPS
• Select languages
• Import Translations
• Add Sample Content
• Setup Site Info
ADDING .MAKE FILES
.MAKEapi = 2
core = 7.x
; Include the definition for how to build Drupal core directly
includes[] = drupal-org-core.make
!
;Multilingual Starterkit Install Profile
projects[multilingual_starterkit][download][type] = "git"
projects[multilingual_starterkit][download][url] = "https://github.com/pixelite/drupal-multilingual-starterkit"
projects[multilingual_starterkit][download][branch] = "master"
projects[multilingual_starterkit][type] = "profile"
DRUPAL-ORG-CORE.MAKEcore = 7.x
api = 2
!projects[drupal][version] = "7.31"
!projects[views_bulk_operations][version] = "3.2"
projects[views_bulk_operations][subdir] = "contrib"
!projects[admin_menu][version] = "3.0-rc4"
projects[admin_menu][subdir] = "contrib"
!projects[admin_views][version] = "1.3"
USING THE MAKE FILESDownload the make files:
curl https://raw.githubusercontent.com/pixelite/drupal-multilingual-starterkit/master/build-mulitilingual-starterkit.make -o build-multilingual-starterkit.make
curl https://raw.githubusercontent.com/pixelite/drupal-multilingual-starterkit/master/drupal-org-core.make -o drupal-org-core.make
Run the make files using Drush:
drush make build-multilingual-starterkit.make
Drupal Consulting, Development, and Training evolvingweb.ca
Suzanne Dergacheva, Co-founder @suzanne_kennedy
TRAINING PROGRAMevolvingweb.ca/training
!