_locale_import_po passing in a file I am trying to use _locale_import_po($file, $langcode, $mode, $group = NULL).  I want to point it to a local file in my Drupal site (e.g. drupal-7.23.fr.po').

However, when I try to do this I get the following error:


  fopen(): Filename cannot be empty locale.inc:693


I am using the following code to initialize the $file variable passed to the function.

  $file = new stdClass();
  $file-&gt;filename = 'drupal-7.23.fr.po';
  $file-&gt;filepath = drupal_get_path('module', 'mymodule') .'/'. $file-&gt;filename;


I have the file in sites/all/modules/mymodule/drupal-7.23.fr.po.
Line 693 of locale.inc is

$fd = fopen($file-&gt;uri, 'rb');


So you need to provide your file path on the uri member of the file object, instead of/in addition to filepath.

There are a bunch of different things done with that file object throughout the process you're calling, so there may be more you need to add as well.