[VM3.0.18] Wrong language in virtuemart order status email

Started by Cameleon, November 17, 2016, 15:25:58 PM

Previous topic - Next topic

Cameleon

Goof afternoon,

I'm currently developping a multilingual shop, and i'm stuck by the following problem :

I've made two order, one on the french version of the site (main language) and one on the english version.

I've opened the database, and the order_language is correctly set :
order_language = en-GB for english order
order_language = fr-FR for french order

Both language are set correctly in the virtuemart configuration, translation file are at the right place, and the option "display untranslated string in english" is checked.

But, all my notification emails are in french.

If i set english as my default admin language, all the notification emails are in english, but not the one for "Payment Confirmed". Even the french are in english then.

I've taken a look at sendVmMail and everithing seems fine :

      if($noVendorMail and !empty($view->orderDetails) and !empty($view->orderDetails['details']['BT']->order_language)) {
         VmConfig::loadJLang('com_virtuemart',true,$view->orderDetails['details']['BT']->order_language);
         VmConfig::loadJLang('com_virtuemart_shoppers',TRUE,$view->orderDetails['details']['BT']->order_language);
         VmConfig::loadJLang('com_virtuemart_orders',TRUE,$view->orderDetails['details']['BT']->order_language);
         vmdebug('With order language ',$view->orderDetails['details']['BT']->order_language);
         vmTrace('sendVmMail');
      }

I don't know what's wrong here, could someone help me ?

Cameleon

I did some other test.

The language of the notification emails, when sent by updating the order's status, use the language chosen in "Backend Language" in my admin account profil. Even if the order's language is in a different language.

I really don't know what to do to avoid this.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Cameleon

Hi,

I've tried everything, and i still have my first invoice (automatically sent after payment confirmation) in the default language of my website.
In the emails, the products names are in the correct language, but everything else is in the default language.

The notifications sent after updating the order's status in the admin are fine and have the same language as the order.

I've inserted some test to send me the value used by VmConfig::loadJLang() in sendVmMail() and the language code used is correct (en-GB, fr-FR, ect...).

I've tried both virtuemart version (with and without the loadOrderLanguages() function).

My language files are all synchronised.

Could anyone have an idea about the source of this malfunction ?

EDIT : Another test, the value of $this->orderDetails['details']['BT']->order_language in the Email template (/views/invoices/tmpl/mail_html.php) has the correct value (en-EN) but still send the first email in french.