VirtueMart Forum

VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: jabba on December 05, 2017, 16:16:56 pm

Title: Last update ignores language override in mail?
Post by: jabba on December 05, 2017, 16:16:56 pm
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
Title: Re: Last update ignores language override in mail?
Post by: Milbo on December 07, 2017, 13:20:07 pm
I am very sure it is not since the last update. Mail and order overrides should be always placed in the Backend AND Frontend.
Title: Re: Last update ignores language override in mail?
Post by: jabba on December 07, 2017, 18:02:11 pm
Ok, thank you very much.
I think then i have a problem understating how override works.

This is my invoice_items.php:

Code: [Select]
<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:

(https://www.pixed.it/att/Cattura.JPG)

but in the PDF of the invoice i get nothing

(https://www.pixed.it/att/Cattura2.JPG)

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

Am i missing something? Thank you!
Title: Re: Last update ignores language override in mail?
Post by: Studio 42 on December 08, 2017, 01:07:19 am
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

Title: Re: Last update ignores language override in mail?
Post by: Studio 42 on December 08, 2017, 01:28:06 am
For the devs,
Here is how i load the language now (always 1 only)
Code: [Select]
$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);
Title: Re: Last update ignores language override in mail?
Post by: jabba on December 09, 2017, 16:44:37 pm
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
Title: Re: Last update ignores language override in mail?
Post by: Milbo on December 10, 2017, 01:26:14 am
btw, do you use vm3.2.6 or vm3.2.8?
Title: Re: Last update ignores language override in mail?
Post by: jabba on December 12, 2017, 12:28:38 pm
Updated a couple of days ago to 3.2.8