Skip to content

Instantly share code, notes, and snippets.

@timmillwood
Created March 24, 2015 09:21
Show Gist options
  • Save timmillwood/8e65ea63dece5ce1f33c to your computer and use it in GitHub Desktop.
Save timmillwood/8e65ea63dece5ce1f33c to your computer and use it in GitHub Desktop.
Importing a po file in hook update
<?php
/**
* Add pt translations
*/
function hook_update_7001() {
$path = drupal_get_path('module', 'mymodule');
$poFile = $path . '/translations/pt-pt-mymodule-7.x-1.0.po';
$file = new stdClass;
$file->uri = $poFile;
$file->filename = basename($poFile);
_locale_import_po($file, 'pt-pt', LOCALE_IMPORT_OVERWRITE, 'default');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment