Author Topic: Last update ignores language override in mail?  (Read 251 times)

jabba

  • Beginner
  • *
  • Posts: 23
    • Pixed - Web Store Assistance
Last update ignores language override in mail?
« 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
Gianluca Gabella - CEO & Web Developer @ Pixed s.n.c.b - www.pixed.it

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9415
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Last update ignores language override in mail?
« Reply #1 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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jabba

  • Beginner
  • *
  • Posts: 23
    • Pixed - Web Store Assistance
Re: Last update ignores language override in mail?
« Reply #2 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:



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 s.n.c.b - www.pixed.it

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2413
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Last update ignores language override in mail?
« Reply #3 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


Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2413
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Last update ignores language override in mail?
« Reply #4 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);

jabba

  • Beginner
  • *
  • Posts: 23
    • Pixed - Web Store Assistance
Re: Last update ignores language override in mail?
« Reply #5 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
Gianluca Gabella - CEO & Web Developer @ Pixed s.n.c.b - www.pixed.it

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9415
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Last update ignores language override in mail?
« Reply #6 on: December 10, 2017, 01:26:14 am »
btw, do you use vm3.2.6 or vm3.2.8?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jabba

  • Beginner
  • *
  • Posts: 23
    • Pixed - Web Store Assistance
Re: Last update ignores language override in mail?
« Reply #7 on: Today at 12:28:38 »
Updated a couple of days ago to 3.2.8
Gianluca Gabella - CEO & Web Developer @ Pixed s.n.c.b - www.pixed.it