VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: loui on October 27, 2016, 01:49:23 AM

Title: Emails are not in Customers Language
Post by: loui on October 27, 2016, 01:49:23 AM
Joomla! 3.6.4
PHP-Version 5.6.26
VirtueMart 3.0.18


Hi there,

I have a multilingual shop. 5 languages.
BE language is German.

I recieve the Customer Confirmation in the chosen language from the FE. Thats OK!
When i confirm in the BE, the Email as also PDF are generated in the BE language (German), which is wrong, not in Customers language.

What i am doing wrong??

*Edit*
I updated to PHP 7
Multilanguage status: all green

Problem still the same :(
Title: Re: Emails are not in Customers Language
Post by: jjk on October 29, 2016, 23:15:19 PM
Just checked the confirmation email sent to the customer and the pdf invoice in one of my bilingual (German/English) VM 3.0.18 test installations. I'm using an english language backend. If the order is made in German, the email to the customer and the pdf incvoice are generated and sent in German, too. So it works in my case.
Do you use any third party VM extensions or a third party VM template?
Title: Re: Emails are not in Customers Language
Post by: loui on October 31, 2016, 13:55:29 PM
Thank you for your answer!

I only use "KC VM Registration Redirect" which i deactivated to try if it coused the problem. Didn't help.
Also i dont use a 3rd party VM template. Its strange couse this is been a problem in earlier versions and maybe still a bug.
Title: Re: Emails are not in Customers Language
Post by: jjk on October 31, 2016, 23:15:24 PM
I did have a look at your website but currently don't have the time to investigate your issues thoroughly.

The initial confirmation emails are sent in the correct language. But status order changes are probably sent in the selected admin language. Perhaps you can test this by changing your admin language to English temporarily and then check the emails after order status changes and the pdf invoice language again.

Perhaps check if this makes a difference: Go to Extensions > Plugins > System Language Code. It is activated, but no Language codes are added. You may use for example en for English and de for German.

Also some users reported problems with php 7 and reverting back to php 5.6 solved their problem. (Just a hint - don't remember if your specific problem is related to the php version).

For your invoices and order confimation emails some strings still need to be translated - like for example "Zahlbar innerhalb von 14 Tagen" is shown in the english language pdf invoice.
Title: Re: Emails are not in Customers Language
Post by: loui on October 31, 2016, 23:40:55 PM
Thank you for looking into!

QuoteThe initial confirmation emails are sent in the correct language. But status order changes are probably sent in the selected admin language.

This is definitaly the case. I tested this.

QuotePerhaps check if this makes a difference: Go to Extensions > Plugins > System Language Code. It is activated, but no Language codes are added. You may use for example en for English and de for German.

Tested this also with "de-DE" and "de" only. Made no difference.

I dont think thats a PHP version problem. I came from PHP 5.6 after long testing and tryed PHP7 in hope it would help. I will try to downgrade to PHP5.6 as you told.

Quotesome strings still need to be translated
Thank you. I know that. Will be added later. First i need to fix this BE/FE problem somehow.
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 01, 2016, 21:59:37 PM
can confirm this issue for J3, with J2.5 all works fine
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 02, 2016, 20:26:36 PM
it is solved in the next release
Title: Re: Emails are not in Customers Language
Post by: loui on November 03, 2016, 23:08:42 PM
Quoteit is solved in the next release

This would be great. Thank you!
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 04, 2016, 20:20:36 PM
This testversion includes the fix:
http://dev.virtuemart.net/attachments/download/1025/com_virtuemart.3.0.18.1_extract_first.zip, of course use a backup for testing
Title: Re: Emails are not in Customers Language
Post by: loui on November 07, 2016, 17:44:37 PM
Thank you!

Neu version (3.0.18.1)  is installed after Backup.

Now i have new Problems:

In Customers Language are Cart and Product details missing.

Just getting an 404 Error.

*EDIT*

i could not fix this so i installed new as multilingual and now it works.

Title: Re: Emails are not in Customers Language
Post by: loui on November 13, 2016, 01:56:20 AM
NEW Vers.
VirtueMart 3.0.18.2
=================

OK i think i found something.

1. Without Language-Overrides (Admin) seems to be ok.... but
- if i add some overrides it takes the wrong one .ini -

4 Example: Try this in de-DE.override.ini and make an order in ENG:
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_C="Bestätigung Ihrer Bestellung Nr.%3$s - %1$s"
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_P="Ihre Bestellung Nr.%3$s wird bearbeitet - %1$s"
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_R="Ihre Bestellung Nr.%3$s wurde rückerstattet - %1$s"
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_S="Ihre Bestellung Nr.%3$s wurde versendet - %1$s"
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_X="Ihre Bestellung Nr.%3$s wurde storniert - %1$s"
COM_VIRTUEMART_MAIL_SUBJ_SHOPPER_U="Ihre Bestellung Nr.%3$s ist bestätigt - %1$s"


2. Also i get the wrong language HEAD & FOOTER in the invoice when confirmed in BE.

Title: Re: Emails are not in Customers Language
Post by: jjk on November 14, 2016, 22:02:15 PM
Does it work with VM 3.0.18.3 in your case?
Title: Re: Emails are not in Customers Language
Post by: loui on November 15, 2016, 00:29:13 AM
QuoteDoes it work with VM 3.0.18.3 in your case?

Still exactly the same   :-\

Confirmation from BE (without override.ini) gets the wrong language Header/Footer for the invoice PDF.  Invoice content is ok.
Confirmation from BE (with override.ini) gets the wrong language Header/Footer for the invoice PDF.  Invoice content is also wrong ini.

FE looks good!
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 19, 2016, 17:03:14 PM
Header and Footer is fixed in the last release 3.0.18.4

But it seems not possible to change the used language of the overrides. One working solution for the invoice may be the following:  delete the overrides for each language and add these overrides as your own language files to your template.

https://www.yireo.com/tutorials/joomla/joomla-programming/721-load-a-custom-language-file-in-your-joomla-template
Title: Re: Emails are not in Customers Language
Post by: loui on November 19, 2016, 23:57:26 PM
QuoteHeader and Footer is fixed in the last release 3.0.18.4

In the BE > Shop > E-Mails - SamplePDF(preview) = works well
Im my send-out/confirmed Email Header/Footer as also Invoice PDF Header/Footer = still the wrong language

Now also the content inbetween is wrong language.

QuoteOne working solution for the invoice may be the following:  delete the overrides for each language and add these overrides as your own language files to your template.
sounds good. I need to try this.

Thank you!
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 20, 2016, 02:05:28 AM
I think that VM does not add the lang tag in the link to generate the order, so it use the default one.
When i need more then one language in Joomla, i use instance foreach lang to be sure to get the right one.
eg in a  class:
$jText = array();
if (JLanguage::exists($code)) {
                $this->jText[$code] = JLanguage::getInstance($code);
                $this->jText[$code]->load('com_virtuemart');
                $this->jText[$code]->load('com_virtuemart_order');
            }

and after
$this->jText[$lang]->_('MY_KE_TO_TRANSLATEY);

But i think that Vm use only one instance for all.

eg :
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);
} else {
VmConfig::loadJLang('com_virtuemart_shoppers',TRUE);
VmConfig::loadJLang('com_virtuemart_orders',TRUE);
}
// some line after
vmText::_( 'COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT' );


So, if you send multiple mails, as in this case, language is set to last loaded(or first loaded) order_language, so you are never sure, this is the right language.
vmText sould use a parameter more : vmText::_( 'COM_VIRTUEMART_DEFAULT_MESSAGE_SUBJECT' ,false, ^$order_language);
But in this case only the existing language.ini file loaded are used.(no template overides or Joomla overides).

In all case, it's complicate  if you need to write document in multiple  language at same PHP call.
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 20, 2016, 10:52:40 AM
Quotealso Invoice PDF Header/Footer = still the wrong language

Can't confirm this. I've Header and Footer in the correct order language if I go to Backend and klick "create invoice" with J3.0.18.4. You must delete the old PDF-Files before you generate a new one.


QuoteBut in this case only the existing language.ini file loaded are used.(no template overides or Joomla overides).

But the current problem are the joomla overrides.

QuoteJLanguage::getInstance($code);

I've tried this before, does not work for the overrides.

Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 20, 2016, 19:20:16 PM


QuoteJLanguage::getInstance($code);

I've tried this before, does not work for the overrides.

[/quote]
See JLanguage class in JROOT\libraries\joomla\language\language.php, override is always loaded in the instance(constructor), but if you call this with a administrator link, then this give you the administrator overides and not front end.
So if the called fie are in back-end you need to add your overide in the backend and not in front enn only, it's why i say, this is complicate, because many do the error to add front overide, but the link for orderstatut update is admin side.
Mostly, i add same overide in front and back-end when i know that this can be used in the 2 cases, and worked always.

Of course using languages instances, permit to be completly sure, 2 diferent languages are loading, so you be sure to have not such problems.
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 21, 2016, 00:18:40 AM
Patrick please read the thread, the problems are not FE or BE overrides.
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 21, 2016, 00:32:09 AM
Quote from: loui on October 27, 2016, 01:49:23 AM
Joomla! 3.6.4
PHP-Version 5.6.26
VirtueMart 3.0.18


Hi there,

I have a multilingual shop. 5 languages.
BE language is German.

I recieve the Customer Confirmation in the chosen language from the FE. Thats OK!
When i confirm in the BE, the Email as also PDF are generated in the BE language (German), which is wrong, not in Customers language.

What i am doing wrong??

*Edit*
I updated to PHP 7
Multilanguage status: all green

Problem still the same :(


Is the first post.
I give you the technic i use to write multilingual PDF at same time, that always set the right language.
You said it not work because overide(or another user), but it work and i added the ref, it's all.

I think you know that in case of multiple mails call , you  not reload the languages(as i know) so this can load another language, because you don't use instance.
I don't know exactly the problem here, but i have same problem, with mixed language content in orders, subjects ... So i give you my solution that never give me any problems. Or the other one, adding the missing key and overides in back-end too.

But if you know why this not work always, then please fix it and we are all happy.
Regards,

Patrick
Title: Re: Emails are not in Customers Language
Post by: loui on November 21, 2016, 16:02:31 PM
QuoteI've Header and Footer in the correct order language if I go to Backend and klick "create invoice" with J3.0.18.4.

I think you mean "force creation of invoice-Button" in the BE orders view - this works well

Not so if i look into the send Email H/F and Invoice H/F after BE order cofirmation.

*EDIT*
Quote from: K&K media production on November 19, 2016, 17:03:14 PM
Header and Footer is fixed in the last release 3.0.18.4

But it seems not possible to change the used language of the overrides. One working solution for the invoice may be the following:  delete the overrides for each language and add these overrides as your own language files to your template.

https://www.yireo.com/tutorials/joomla/joomla-programming/721-load-a-custom-language-file-in-your-joomla-template
cant get this to work!

i tryed
$language =& JFactory::getLanguage();
$language->load('custom' , dirname(joomla/templates/my_template/language/de-DE/de-DE.custom.ini), $language->getTag(), true);

in the template index.php

and added a file for the overrides to the path. didn't work

also tryed:
$language =& JFactory::getLanguage();
$extension = 'com_virtuemart';
$base_dir = dirname(joomla/templates/my_template/language/de-DE/de-DE.custom.ini);
$language_tag = $language->getTag(); // loads the current language-tag
$language->load($extension, $base_dir, $language_tag, true);


single template ini didn't work
QuoteJOOMLA/language/en-GB/en-GB.tpl_my_template.ini
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 21, 2016, 18:45:36 PM
$language->load('custom' , dirname(joomla/templates/my_template/language/de-DE/de-DE.custom.ini), $language->getTag(), true);
is bad
$language->load('tpl_my_template' , JPATH_SITE.'/templates/my_template/language', $language->getTag(), true);
perhaps better
But try to add your front overides in the administrator language folder and check if it work.
file is administrator/language/overrides/de-DE.override.ini
But if you add your overides in front language/overrides/de-DE.override.ini, this have chance to work to. But i think is that VM force to overides and it's why this remove the original overides.
Joomla doc here https://docs.joomla.org/Loading_extra_language_files and https://docs.joomla.org/Specification_of_language_files
Title: Re: Emails are not in Customers Language
Post by: loui on November 21, 2016, 20:49:01 PM
thank you for your input
Quote from: Studio 42 on November 21, 2016, 18:45:36 PM
$language->load('custom' , dirname(joomla/templates/my_template/language/de-DE/de-DE.custom.ini), $language->getTag(), true);
is bad
$language->load('tpl_my_template' , JPATH_SITE.'/templates/my_template/language', $language->getTag(), true);
perhaps better
i tryed this but had no luck
Quote
But try to add your front overides in the administrator language folder and check if it work.
file is administrator/language/overrides/de-DE.override.ini
But if you add your overides in front language/overrides/de-DE.override.ini, this have chance to work to. But i think is that VM force to overides and it's why this remove the original overides.
Joomla doc here https://docs.joomla.org/Loading_extra_language_files and https://docs.joomla.org/Specification_of_language_files
FE overrides didn't work in admin side also BE didn't work in FE view.

i think we have here a pretty complex issue with the languages to be shown correctly in all cases like emails and emailPDFs.
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 21, 2016, 21:20:41 PM
See message before http://forum.virtuemart.net/index.php?topic=135863.msg474630#msg474630
But are your language files not bad formated ? You can try to activate language debug in Joomla config, and display the order view, you get a report on the debug position, if keys are missing, or errors in language files.
Title: Re: Emails are not in Customers Language
Post by: K&K media production on November 22, 2016, 10:03:52 AM
try

$language->load('custom' , JPATH_SITE.'/templates/my_template', $language->getTag(), true);

filename: de-DE.custom.ini
Title: Re: Emails are not in Customers Language
Post by: loui on November 22, 2016, 16:41:09 PM
no errors in language files.

just a bit curious about this ...
**Nicht geladen** : JROOT/administrator/language/de-DE/de-DE.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/language/en-GB/en-GB.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/components/com_tcpdf/language/de-DE/de-DE.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/components/com_tcpdf/language/en-GB/en-GB.com_tcpdf.sys.ini


Quote$language->load('custom' , JPATH_SITE.'/templates/my_template', $language->getTag(), true);

filename: de-DE.custom.ini
didn't work

i am now on
VirtueMart 3.0.18.5 Blue Corvus 9386

*EDIT*

OK. I finaly got the index.php to load this file with:

$language =& JFactory::getLanguage();
$language->load('tpl_my_template' , JPATH_SITE.'/templates/my_template', $language->getTag(), true);


ini is loaded
**Geladen** : JROOT/templates/my_template/language/de-DE/de-DE.tpl_my_template.ini

but its overwriten by other ini loaded after this like:
Quote**Geladen** : JROOT/language/de-DE/de-DE.com_virtuemart.ini

may be i need to load it as last one ...
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on November 22, 2016, 21:55:19 PM
It's what i said before. Because Virtuemart force sometime overide, any change are removed, it's why using the real Joomla language overrides, can perhaps work better:
see YOURSITE/administrator/index.php?option=com_languages&view=overrides and add here your overrides.

For :
**Nicht geladen** : JROOT/administrator/language/de-DE/de-DE.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/language/en-GB/en-GB.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/components/com_tcpdf/language/de-DE/de-DE.com_tcpdf.sys.ini
**Nicht geladen** : JROOT/administrator/components/com_tcpdf/language/en-GB/en-GB.com_tcpdf.sys.ini
This is because the files are not existing, but perhaps you have another problem ?

You need perhpas to remove com_tcpf from Joomla(best on using joomla manager.)
And extract from com_virtuemart.3.0.18_extract_first.zip package the new one and install it. should perhaps solve the problem.
(I don't understand why this is not a package, but a component, but this is another history.)

And yes, to be sure your own translations are used you need to load after and overide Vm language files too(or use com_languages overrides).
Title: Re: Emails are not in Customers Language
Post by: Milbo on December 21, 2016, 22:20:12 PM
Quote from: Studio 42 on November 20, 2016, 02:05:28 AM
I think that VM does not add the lang tag in the link to generate the order, so it use the default one.
When i need more then one language in Joomla, i use instance foreach lang to be sure to get the right one.
eg in a  class:
$jText = array();
if (JLanguage::exists($code)) {
                $this->jText[$code] = JLanguage::getInstance($code);
                $this->jText[$code]->load('com_virtuemart');
                $this->jText[$code]->load('com_virtuemart_order');
            }

and after
$this->jText[$lang]->_('MY_KE_TO_TRANSLATEY);


Thank you, check the code, I think I got it now. I mixed your ideas with mine and think it is solved now
Title: Re: Emails are not in Customers Language
Post by: Aglaia on February 09, 2017, 10:44:11 AM
Hi,

I am working with VM 3.0.18
Joomla! 3.6.5
php-Version     5.6.28

I have the same problem wth the e-mails.

Milbo – you said you have solved it. Can you please tell me how.
Thanks
Title: Re: Emails are not in Customers Language
Post by: jjk on February 09, 2017, 12:01:29 PM
Probably the fix was included in VM 3.0.18.5. But I would suggest to test and eventually update to VM 3.0.19.5.
http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: Emails are not in Customers Language
Post by: Aglaia on February 09, 2017, 18:58:31 PM
I did but it is still the same.
Title: Re: Emails are not in Customers Language
Post by: Studio 42 on February 09, 2017, 22:41:05 PM
Have you update your language file, perhaps the key do not exist in your language file?
see https://virtuemart.net/community/translations for the language packs
Title: Re: Emails are not in Customers Language
Post by: Lanthruster on March 27, 2017, 13:09:50 PM
If somebody is still interested - it's a bug in virtuemart, judging by the sources - present up to the latest release. Spent about 7 hours tracing it.