[Drupal] Import and export translated strings

October 13, 2016 - 16:04

In this article lets see how to import and export translation strings to Drupal site. Drupal uses the .po (portable object) and .pot (portable object template) extensions for the translation files. Difference between .po and .pot files:

  • .pot: It is portable object template. This is the file which we send to the translators.
  • .po: It stands for 'portable object'. This file will include the original as well as translated texts.

.po file contains 'msgid' were we need to added actual string, and 'msgstr' for adding translated content. The .po file format:

  msgid 'Hello World'
 msgstr 'مرحبا بالعالم'

In case of Drupal .pot file can be imported from the site. For importing .pot file, login as admin, goto path Admin > Configuration > Regional And language > Translate interface, click on 'Export' tab. Click on export button to generate .pot file. This file can be send for translation.

After translated file is generated i.e, .po file we could import that one to the site. For that, goto path Admin > Configuration > Regional And language > Translate interface, click on 'Import' tab, browse the language file (.po) and click import.

Note: If needed to process all .po files go to tab 'Update from code' and click import, doing so will import all po files defined in modules. Remember: PO files that appear to have changed will be processed again.

Get Drupal updates straight to your inbox

To prevent automated spam submissions leave this field empty.

Post your comments / questions