[Drupal] Import and Export Translated Strings
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 the case of Drupal .pot file can be imported from the site. For importing .pot file, login as admin, go to path Admin > Configuration > Regional And language > Translate interface, click on 'Export' tab. Click on the export button to generate the .pot file. This file can be sent 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.