Thursday, 13 June 2013

Building a Multi-language Site (Website localization) in Drupal-7

It’s very easy to build multilingual sites using Drupal. You have to just install and configure few modules and multi-language site starts working. Following are simple steps to localize a site in Drupal 7.
Note! urls in this tutorial like (admin/build/modules) means (www.ursite.com/admin/build/modules)or (localhost/ursite/admin/build/modules)
  1. Install Internationalization module
  2. Go to the modules (admin/modules) and in Core section enable
    • Locale
    • Content translation
  3. Add new language from site
    • Go to the Languages page(admin/config/regional/language)
    • Add required languages (admin/config/regional/language/add)
    • Choose edit on languages page(admin/config/regional/language/edit/ur)
    • In the Language path prefix language code  enter Path prefix and save language
    • Make sure English is the default language
  4. Add translations
    • Download and install localization update module http://drupal.org/project/l10n_update
    • Enabling localization update module will get and add translation strings of all languages which you added.
    • To update translations goto (admin/config/regional/translate/update)
    • Click Update translations button
    • Wait patiently as the module gets all your translations
    • (optional, but recommended) Configure settings to get updates regularly via cron at: (admin/settings/language/update -Drupal 6) and (admin/config/regional/language/update  -Drupal 7)
  5. Configure language switching settings from(admin/config/regional/language/configure)
  6. Enable and place language switcher block on right place.
     
  7. Translate (Create and Import PO files)
    1. There are two types of strings which need to be translated
      1. Translate strings in database
        • To create .po files of database strings like variables, menu, blocks i18n has feature to extract and save .po files on your system.
        • Goto (admin/config/regional/translate/export) to export database strings to .po files.
      2. Translate strings in code files
      • To create .po files of core, community, or custom modules or theme files you will have to install Translation template extractor module ( http://drupal.org/project/potx/).
      • After installing this module goto(admin/config/regional/translate/extract).
      • Select file or directory and extract.
      • Remember to use t() function for strings in module\theme files and Drupal.t() for Javascript files.
    2. After extracting use tool like Poedit (http://www.poedit.net/download.php) to insert the translated strings.
    3. Once .po file completed with strings translated into target language just goto (admin/config/regional/translate/import) and import the .po file.

2 comments:

  1. You can use https://poeditor.com/ to easily translate a website into multiple languages and improve the workflow.

    ReplyDelete