VirtueMart Forum

VirtueMart 2 + 3 => Installation, Migration & Upgrade => Topic started by: ptrouw on January 26, 2017, 15:36:50 pm

Title: Multilanguage - language change issues
Post by: ptrouw on January 26, 2017, 15:36:50 pm
After upgrade to 3.0.18.7 the cart and search module and category product overview pages don't switch languages correctly.
After switching from for instance DE to NL the cart text on the homepage module isn't changing. Only after a second refresh the whole page has changed. It shows that the module has changed to DE, only the visible text string is still in Dutch "Winkelwagen is leeg", as you can see on the screen-shot.
Would a upgrade to 3.0.18.9 make a difference?
Title: Re: Multilanguage - language change issues
Post by: bortolani on January 27, 2017, 00:14:37 am
I have the same problem: most strings are translated only after a second reload.

Now using VM 3.0.18.9 and Joomla 3.6.5 but the problem has been there also in previous versions.

You may easyly check that at www.puffosport.it

 
Title: Re: Multilanguage - language change issues
Post by: ptrouw on January 27, 2017, 13:59:30 pm
Yes, the same problem. Also sometimes it shows the string "MOD_VIRTUEMART_SEARCH_TEXT_TXT" in the search box instead of translation. Also here, a refresh does the job!
Title: Re: Multilanguage - language change issues
Post by: jjk on January 27, 2017, 14:30:53 pm
I have the same language switcher problem using the old (deprecated) VM Frontpage as the homepage and in the category views my 'Category description' and the 'Category name' don't switch with the first click on a different language flag.

In my case the category content switches completely if I disable my 'System VM OG Meta Tag' plugin.

Please check the following:
1. Check if disabling a third party VM plugin results into an improvement.
2. Set the 'System language switcher' plugin to 0 or first position (click on the plugin in adjust the order in the right hand dropdown list)

Didn't test yet to replace the VM Frontpage with the new category page system.
Title: Re: Multilanguage - language change issues
Post by: bortolani on January 27, 2017, 17:08:06 pm
Tried both suggestions but did not work.
The problem has nothing to do with frontpage or category pages.
I have the feeling that it might not be related to VM but to Joomla.
Title: Re: Multilanguage - language change issues
Post by: Studio 42 on January 28, 2017, 12:35:47 pm
@bortolani
Have you disable the Joomla cache for test ?
Title: Re: Multilanguage - language change issues
Post by: jjk on January 28, 2017, 13:44:56 pm
@Studio 42
Tested various settings yesterday, but was unable to find the source of the problem. When VM debug is enabled, you will see that some VM parts don't switch the language with the first click on a flag. The issues appeared only in the last few developer versions of VM. But to date none of the testers discovered what is causing this behavior.
Title: Re: Multilanguage - language change issues
Post by: Milbo on January 28, 2017, 13:48:33 pm
I have the feeling that it might not be related to VM but to Joomla.

Interesting point. It is maybe also related to the used php version. Also some 3rd party must be part of it, because I was not able to reproduce it on my system.
Title: Re: Multilanguage - language change issues
Post by: Milbo on January 28, 2017, 13:50:48 pm
When VM debug is enabled, you will see that some VM parts don't switch the language with the first click on a flag.

There you see the culprit. I just need a vmTrace there. Makes it a difference with or without SEF?
Title: Re: Multilanguage - language change issues
Post by: bortolani on January 28, 2017, 14:21:26 pm
Hi, I tested several configurations and the problem persists regardless of cache and seo, i.e. no matter if cache is enabled or not or SEF turned on or off, still translations are applied only on second reload.

Probably a 3rd party plugin. My impression is that T3 framework is causing the problem, but it's just a guess.

If you want I can give you full access to my test site www.puffosport.it/puffo2 to see if you have a better guess.
Title: Re: Multilanguage - language change issues
Post by: Milbo on January 28, 2017, 19:47:36 pm
Sounds great, please send me per pn
Title: Re: Multilanguage - language change issues
Post by: Milbo on January 28, 2017, 22:06:47 pm
2. Set the 'System language switcher' plugin to 0 or first position (click on the plugin in adjust the order in the right hand dropdown list)

First position, that is the key. I checked the page of bortolani, there are a lot plugins with "ordering" 0, but when you have 9 plugins which set them self on ordering 0,....
POSITION ! not the set ORDERING value! Just setting the plugin to top did not help, because most plugins stayed on top. So any plugin with ordering 0 should be set to position 1, except the 2 standard joomla plugins with ordering 0.
Title: Re: Multilanguage - language change issues
Post by: bortolani on January 28, 2017, 22:48:10 pm
Hi Milbo, I'm not sure I understood you.
I moved the 2 language plugins (language filter and language code) and now they appear in the first two positions among system plugins, (ordering 0 and 1 respectively).
I can't see a way to move them ahead of other plugin types as each plugin type has its own ordering.

Moving the language plugins on top had no effect, still you need 2 reloads to set the lang variables as shown by vmdebug.

Probably I missed some steps...
Title: Re: Multilanguage - language change issues
Post by: Milbo on January 29, 2017, 20:42:59 pm
I tested a lot different ideas on bortolanis page, thank you for the direct access, so I could directly debug on the files.

It is always the same problem, some plugins use the onAfterInitialise() event. Even it sounds like that, it is not a good trigger, because joomla is NOT fully initialised. The routing (GET vars) and therefore the new language is missing. The language is meanwhile set per session to the last selected language.

The only way to avoid this, is to change the triggers in the plugins and to replace onAfterInitialise against onAfterRoute.

I even added as test a parameter to load the config without language, but then the plugin throwed errors for having no language. So some plugins, which use both events and dont need the language in onAfterInitialise can now load the config without language (3rd parameter to false)
Title: Re: Multilanguage - language change issues
Post by: ptrouw on February 12, 2017, 20:58:39 pm
This tread is becoming very technical, but I still have the problem and don't know how to fix it. It seems that the site of bortolani, www.puffosport.it, works fine now. Can you confirm this? If so what was the fix?
Title: Re: Multilanguage - language change issues
Post by: lindapowers on February 13, 2017, 01:57:43 am
Some of us managing multilingual  sites had these problem in the past and with all the guys I spoke it ended up being a plugin causing the issue as Milbo described.

For us it was a custom made plugin, others a one page checkout plugin etc
Title: Re: Multilanguage - language change issues
Post by: Studio 42 on February 13, 2017, 02:55:01 am
A customer reported me yesterday a similar issue using Sp page builder , so i think that the bug is in Joomla and reordering language plugin should solve this.
Note that you can have other that "system" plugin called, so language filter should be on top of the list of all plugins.
Title: Re: Multilanguage - language change issues
Post by: ptrouw on February 13, 2017, 08:52:22 am
I tried the reorder. Unfortunately no difference. As I mentioned in my first post of this tread, after a second refresh the whole page has changed correctly.
Title: Re: Multilanguage - language change issues
Post by: Milbo on February 13, 2017, 12:09:43 pm
It seems there is a problem with the piwik of alatak
Title: Re: Multilanguage - language change issues
Post by: ptrouw on February 13, 2017, 13:00:15 pm
For now I fixed the problem with disabling one of the plug-ins.
But what I understood so far, is that changes made in recent VM versions don't work nicely any more with a lot of 3rd party plug-ins. It seems to be discussion if the implementation of the language thing is correct in VM and therefore the problem leis within the 3rd party plug-ins!
As we run 2 major ehops with significant sales and also with quite a few plug-ins this makes our life very difficult. And this makes the process with core updates very very tricky.
Title: Re: Multilanguage - language change issues
Post by: Milbo on February 13, 2017, 14:52:20 pm
It is unevitable. From my viewpoint the bug is in joomla, or better said, the problem. It is also not a problem, when people write properly. It means always that their plugins were not correctly working already in multilanguage systems. You just notice it now also for single language page.

So when we want to solve the problem, that we can send 2 emails in different language, or just use 2 different languages at the same time, then we need this new system. So always when your user or admin does not use the shop default language, we had a problem before. For example the problem with the overrides was not solveable on another way. So which plugins did you unpublish? Most time it is a simple fix, just by removing quickn dirty stuff.
Title: Re: Multilanguage - language change issues
Post by: ptrouw on February 13, 2017, 16:22:21 pm
Why didn't I had any problems with 3.0.16 and earlier release? Doesn't that mean is has to do with the newer VM releases.
BTW is was the dropshipment plug-in.
Title: Re: Multilanguage - language change issues
Post by: Studio 42 on February 13, 2017, 16:32:01 pm
The problems is that other 3party as sp page builder, override the Joomla language directly and this is saved in the session in filter language plugin, other simply force a language.
But the other problem is that Joomla language filter plugin is bugged too when you need to full remove the prefix for default language.
I have write a plugin(in beta test for now) to fix this behavior for my language switcher, because it's a problem for some user needing to always remove the /en prefix in sef mode because google site complain about this.
Note that this problem is not in all case and apparently depend the other plugins and some SEF plugin and components adding own rules in sef links.
Title: Re: Multilanguage - language change issues
Post by: Milbo on February 20, 2017, 15:45:39 pm
No, the problem is the "onAfterInitialise" trigger, which provides the joomla languge set by the session. Because it is fired before the "onAfterRoute" event. But you must route to know which language got selected.

VM used for vmText just the old code of joomla, which gets the language object for any call by the JFactory. We want to use different JLanguage objects in the vmText, so we cannot use anylonger the JFactory::getLanguage. We set now the language, which is also more performant. But when it is not set,... it throws an error. It was not a big deal to avoid this errors. But when the language is set by session to en and it is changed by the route to de,... the language en got already loaded and cached in vm. So we get the wrong language. Therefore the config has now a new parameter, "do not initialise the language".

We gain a lot advantages due this change. Only 3rd party using one of these both triggers notice a difference, the rest works as before.