Export and Import translated strings in Drupal

We have a drupal web application which requires multiple language translations. We deployed it in a production server and a stage server. Data entry operator(translator) has inserted translated strings of different languages in stage server and we have tested and found all good. Now we want to import all the translated strings to production server. But we have faced a problem and I am going to tell about the problem and the solution now.
What are the problems we have faced?
Our plan was to export language from language and translation configuration interface as *.po file, and import all the *.po file into production server. But while we were trying to export, it threw an error. We checked at recent log messages and found an unclear error message denoted "unrecoverable error”. Then we tried to export through drush. We have installed the "drush language commands” by the following one line command
drush dl drush_language
I tried to export by the following command
drush language-export  

Ex: drush language-export fr translated_strings/fr 
Even now while I tried to export a translation file, it threw an error message like “Incorrect key file for table ‘/path/to/somefile/*.MYI'; try to repair it”. This error message is misleading. There is nothing to repair actually. It is because server is running out of disk space where /tmp is located.
How to solve the problem?
We need to increase the space of /tmp directory. We can check the current allocated space by the following command
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda         30G   13G   16G  44% /
udev            495M  4.0K  495M   1% /dev
tmpfs           200M  236K  199M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            498M     0  498M   0% /run/shm
none            100M     0  100M   0% /run/user
overflow         1M     0   1M   0% /tmp
Now we need to stop the services those are using /tmp directory. Usually mysql, httpd uses /tmp directory. You can list out all such processes by following command.
sudo lsof | grep tmp
php5-fpm  10340         www-data  mem       REG              253,0     105664    1443066 /usr/lib/x86_64-linux-gnu/librtmp.so.0
mysqld    26096            mysql    4u      REG               0,20          0   50024645 /tmp/ibSm3Vry (deleted)
Kill the processes according to the number
kill Ex. kill 26096 Ref:
  • http://askubuntu.com/questions/199565/update-failing-not-enough-space-on-tmp
  • http://askubuntu.com/a/199708
Increase the size of /tmp in linux
sudo umount /tmp
sudo mount -t tmpfs -o size=10485760,mode=1777 overflow /tmp
Now you can see the /tmp directory with 10MB space. Now run the export command
drush language-export  

Ex: drush language-export fr translated_strings/fr 
Copied to production server and imported
drush language-import  

Ex: drush language-import fr translated_strings/fr 
Thanks for reading this.

Share this post

Leave a comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.