Skip to content

Instantly share code, notes, and snippets.

@kmoll
Forked from timmillwood/mymodule.install
Last active August 29, 2015 14:17
Show Gist options
  • Save kmoll/ac2018c11727e3a69880 to your computer and use it in GitHub Desktop.
Save kmoll/ac2018c11727e3a69880 to your computer and use it in GitHub Desktop.
<?php
/**
* Import translations
*/
function hook_update_7001() {
my_module_import_po_file('pt-pt');
}
function my_module_import_po_file($language) {
$path = drupal_get_path('module', 'mymodule');
$poFile = $path . '/translations/' . $language . '-mymodule-7.x-1.0.po';
$file = new stdClass;
$file->uri = $poFile;
$file->filename = basename($poFile);
_locale_import_po($file, $language, LOCALE_IMPORT_OVERWRITE, 'default');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment