Hi,

I'm rather new to drupal and I had to setup a google shopping feed as an XML file. Because the XML feed would contain 16000+ products we are doing the export overnight using drush and views data export. Now this all works fine apart from the languages. The website is default in Dutch (nl), but is also available in "fr", "en" and "de". And I need exports for each langauge seperatly.

I tried setting global $language before running the batch export, but this doesn't work. The only thing that works is setting the language_default using variable_set(), but this of course results in the fact that my default website is temporarly wrong ... (untill the batch exports end because i then revert it back).

Is there anyother way to set the language during the batch export?

    //set the language needed
    $languages = language_list();
    global $language;
    $defaultLanguage = $language;
    //variable_set('language_default', $languages[$languageForExport]);
    $language = $languages[$languageForExport];

    //start the views_data_export drush functionalities
    $view_name = "google_product_data_feed_new";
    $display_id = "views_data_export_1";
    $output_file = "feeds/google-merchant-".$website."-".$languageForExport.".xml";
    drush_set_option('views_data_export_display_id', $display_id);
    drush_views_data_export($view_name, $display_id, $output_file);

    //set the language back
    //variable_set('language_default', $defaultLanguage);
    $language = $defaultLanguage;

Comments

bobdekinder’s picture

Issue summary: View changes
beumont’s picture

same issue here, my default site language is Polish and I need to export a xml file with Romanian but despite I am selecting "field language -> romanian" the view gets exported in Polish. I need to do this with drush, so is their any possible way?

beumont’s picture

Priority: Normal » Major
beumont’s picture

anyone? Please help I am still having problems with the language export.