News:

Support the VirtueMart project and become a member

Main Menu

Last update ignores language override in mail?

Started by jabba, December 05, 2017, 16:16:56 PM

Previous topic - Next topic

jabba

Hello, i've edited my mail_html_shopperaddresses.php to edit the sent email.
Since the last upgrade Virtuemart ignores the language strings that are present in my joomla language override.
Example:

vmText::_('PXD_VM_CFISCALE') -> returns PXD_VM_CFISCALE even if it's present in joomla language override component

if I add this string to the .ini language file the vmText::_('PXD_VM_CFISCALE') is translated correctly

Thank you
Gianluca Gabella - CEO & Web Developer @ Pixed - www.pixed.it

Milbo

I am very sure it is not since the last update. Mail and order overrides should be always placed in the Backend AND Frontend.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jabba

Ok, thank you very much.
I think then i have a problem understating how override works.

This is my invoice_items.php:

<td style="text-align: right;" class="pricePad" colspan="5"><?php vmText::_('COM_VIRTUEMART_SPESE_CONSEGNA')?></td>

"COM_VIRTUEMART_SPESE_CONSEGNA" is brand new.
The i added the costant in joomla backend, language override:



but in the PDF of the invoice i get nothing



every other costants and language strings works fine, in the right language.

Am i missing something? Thank you!
Gianluca Gabella - CEO & Web Developer @ Pixed - www.pixed.it

Studio 42

I have problem too in last Joomla, i think they changed the way Language is loaded.
The only solution for me was to use 2 files and only load the right one.
Before i loaded for some extentions in front 2 files eg.
fr-FR.my_extentions.sys.ini + fr-FR.my_extentions.ini
and sometime with fallback to english, so 4 files.
But in last Joomla releases if a key is missing in  fr-FR.my_extentions.ini it not load the language from first file fr-FR.my_extentions.sys.ini !
So if you have for eg 2 language loaded and a key is missing in the 2nd file(same language or not), then this is missing.
I dont know since which version this changed , but the worst is that by activating the debug language, the problem disappears, so you cannot see why !
I tried to force reload language option but same result.
Note that joomla lang load use
   public function load($extension = 'joomla', $basePath = JPATH_BASE, $lang = null, $reload = false, $default = true)
$default = true, mean load english at same time.

In last joomla you have now
            if (!$this->debug)
            {
               $path = LanguageHelper::getLanguagePath($basePath, $this->default);

this was not the case before if (!$this->debug) was not in load fonction, so you had always same string loaded


Studio 42

For the devs,
Here is how i load the language now (always 1 only)
$path = PATH_VMCUSTOMSHORTCODES.'/plugins/'.$this->name;
$lang = JFactory::getLanguage();
$tag = $lang->getTag();
$plgName = 'shortcode_'.$this->name ;
if($tag !== 'en-GB' && !file_exists($path.'/language/'.$tag.'/'.$tag.'.'.$plgName.'.ini')) $tag ='en-GB';
$lang->load($plgName, $path,$tag, false, false);


jabba

Thank you for your replies, unfortunately i'm not a developer so i don't know how to change the code to have this works... can you suggest a workaround? I have to add the string in english and italian ini files too? both fronend and backend?
Thank you,
Gianluca
Gianluca Gabella - CEO & Web Developer @ Pixed - www.pixed.it

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/

jabba

Gianluca Gabella - CEO & Web Developer @ Pixed - www.pixed.it