Multilingual

Web Applications 
on  Drupal


Andy Truong — andy at go1.com.au

Twitter: thehongtt

Slide: drupal-i18n.talk.drupal.vc

Language Management

  • /admin/config/regional/
  • Core modules:
    • Locale
    • Content Translation

Language Detection

  • Detect language on context request
  • /admin/config/regional/language/configure
  • Core negotiation providers:
    • URL
    • Session
    • User
    • Browser
    • Default

Language switcher block


  1. Has at least 2 enabled languages
  2. URL Negotiation Provider is enabled

Extendable

  • hook_language_negotiation_info()

Translate Interface

Overview


/admin/config/regional/translate

Translate Interface


Import


Export


Translate Content

Allow content administrator to translate content in system.

Core modules must be enabled:
  • Locale
  • Content Translation

Enable

  • Config content type
    • Publishing Options
      • Multilingual Support
        • Enable
        • Enable with translation
  • /admin/content/node
    • Language filter

Translate Content


Localize.Drupal.org

  1. Community Translation Interface
  2. For Drupal Core
  3. For contributed modules
  4. Import/Export
  5. Linked from Project page

Localize.Drupal.org

  1. Community Translation Interface
  2. For Drupal Core
  3. For contributed modules
  4. Import/Export
  5. Linked from Project page

Localize.Drupal.org

  1. Community Translation Interface
  2. For Drupal Core
  3. For contributed modules
  4. Import/Export
  5. Linked from Project page

Localize.Drupal.org

  1. Community Translation Interface
  2. For Drupal Core
  3. For contributed modules
  4. Import/Export
  5. Linked from Project page

Localize.Drupal.org

  1. Community Translation Interface
  2. For Drupal Core
  3. For contributed modules
  4. Import/Export
  5. Linked from Project page

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

i18n modules

  1. https://drupal.org/project/i18n
  2. Multilingual Blocks — Display block in specific language
  3. Multilingual Variable — Custom Site name per language
  4. Taxonomy Translation
  5. Field Translation
  6. Content Translation
  7. User Translation

Entity Translation

  1. https://drupal.org/project/entity_translation
  2. Core Content Translation module only support node
  3. Added to Core of Drupal 8

Entity Translation

  1. https://drupal.org/project/entity_translation
  2. Core Content Translation module only support node
  3. Added to Core of Drupal 8

Entity Translation

  1. https://drupal.org/project/entity_translation
  2. Core Content Translation module only support node
  3. Added to Core of Drupal 8

API

t() / Drupal.t()

// Simple
echo t('Hello Drupal');

// @see format_string()
// pass through
echo t('Hello !name', array('!name' => 'Drupal'));
// Wrap with 
echo t('Hello %name', array('%name' => 'Drupal'));
// check_plain()
echo t('Hello @name', array('@name' => 'Drupal'));

// @see hook_language_types_info()
echo t('Vietnamese', array('context' => 'Language'));
echo t('Vietnamese', array('context' => 'People'));    

format_plural() / Drupal.formatPlural()

// Notes, t() is already used insideecho format_plural($people, '1 person', '@count people');    

Drupal 8

<3

Question?