VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: elanto75 on November 08, 2019, 15:03:33 PM

Title: [solved]update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 08, 2019, 15:03:33 PM
Hello,
after updating to VirtueMart 3.6.8 10197 when I change the language from the menu on the site side, everything is translated except for the categories and product names. Help!
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Jörgen on November 08, 2019, 15:15:52 PM
Have You translated the categories and the product names ?

An URL would be nice :)

Jörgen @ Kreativ Fotografi
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 08, 2019, 15:34:05 PM
Quote from: Jörgen on November 08, 2019, 15:15:52 PM
Have You translated the categories and the product names ?

An URL would be nice :)

Jörgen @ Kreativ Fotografi

Hello,
They are all translated into 5 languages is a B2B and has been in production for several years now if you want I can send you a private message with user and password

Link: https://b2b.maglificioliliana.com/
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 08, 2019, 16:16:07 PM
I noticed that for the categories and product names the browser language is taken and the language change menu is not considered.

Can someone help me?
Thanks
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Studio 42 on November 08, 2019, 23:45:09 PM
Have you set 1 item menu>virtuemart>category for each shop language?
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 11, 2019, 09:26:01 AM
Quote from: Studio 42 on November 08, 2019, 23:45:09 PM
Have you set 1 item menu>virtuemart>category for each shop language?

it exists
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 11, 2019, 09:50:24 AM
I do not understand,
everything seems to be configured correctly but after updating the categories and product name do not change language instead the descriptions change correctly.
Please help
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Studio 42 on November 11, 2019, 13:09:07 PM
Sorry, but you need to hire someone to debug or give full access to your site, this is not a support center but we can help if we can quick fix it.
In your case, the problem is strange and never reported, so can be a server cache or something specific to your template or config.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: giosto on November 11, 2019, 15:43:59 PM
hi, the same thing is happening to me too, just after updating to version 3.6.8 10197 the language does not change anymore. This happens in a site that has always worked and only in the part concerning virtuemart that is correctly translated.
Giovanni.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 11, 2019, 15:48:34 PM
Quote from: giosto on November 11, 2019, 15:43:59 PM
hi, the same thing is happening to me too, just after updating to version 3.6.8 10197 the language does not change anymore. This happens in a site that has always worked and only in the part concerning virtuemart that is correctly translated.
Giovanni.

I also don't know what to do to fix this, I hope someone can help us solve the problem.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: giosto on November 11, 2019, 16:12:09 PM
activating debug it seems that the language of virtuemart is no longer changed.

1 vmdebug 2 Languages, default shoplanguage (VmConfig::$jDefLang): it_it it-IT Selected VM language (VmConfig::$vmlang): it_it it-IT SEF: it $lfbs =

even if I'm constantly changing the language from Italian to English, debugging ALWAYS reports Italian.

Again, everything worked fine before virtuemart was updated.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Jörgen on November 11, 2019, 19:37:34 PM
Are You using breakdesigns custom fields for all ?

Jörgen @ Kreativ Fotografi
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: jjk on November 11, 2019, 21:07:31 PM
I can't reproduce that language problem. In my case VirtueMart 3.6.8 10197 language switching always loads all translated elements in the selected language.

@elanto75
When I clicked on one of the brands on the login page you linked above, my Firefox inspector initially showed many javascript errors (probably cloud loading problems).
Perhaps clearing all cache files helps.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 12, 2019, 09:07:34 AM
Quote from: jjk on November 11, 2019, 21:07:31 PM
I can't reproduce that language problem. In my case VirtueMart 3.6.8 10197 language switching always loads all translated elements in the selected language.

@elanto75
When I clicked on one of the brands on the login page you linked above, my Firefox inspector initially showed many javascript errors (probably cloud loading problems).
Perhaps clearing all cache files helps.

I did what you said but nothing changed
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Studio 42 on November 22, 2019, 18:54:41 PM
For other users having this problem.
The bug was because a plugin loaded the vmconfig before the language was set.
So reording the system plugin so Joomla language plugin is loaded first should solve the bug.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: Milbo on November 22, 2019, 19:38:46 PM
Damn, that thing again.

Any plugins, which load/use vm files before the core is executed should load the config with

loadConfig($force = FALSE,$fresh = FALSE, $lang = true, $exeTrig = true)

and with correct parameters for that case:

loadConfig(FALSE,FALSE, false, false);


Then it will work correct. VM takes itself the already loaded config and just initialises the language and executes the trigger. I will directly add that to some dev docs tutorial.
Title: Re: update 3.6.8 10197 the categories and products do not change language
Post by: elanto75 on November 25, 2019, 15:09:21 PM
Quote from: Studio 42 on November 22, 2019, 18:54:41 PM
For other users having this problem.
The bug was because a plugin loaded the vmconfig before the language was set.
So reording the system plugin so Joomla language plugin is loaded first should solve the bug.

Thank you, your help was really precious!
Title: Re: [solved]update 3.6.8 10197 the categories and products do not change language
Post by: balai on November 29, 2019, 14:16:55 PM
QuoteloadConfig($force = FALSE,$fresh = FALSE, $lang = true, $exeTrig = true)
This does not solve the problem in all the cases.

Actual Case:
If the plugin calls the \vmConfig::loadConfig function as a preloader (outside the plugin's main class), then the loadConfig is called during the importPlugin function, when the application loads all the plugin files (of type system). I.e. Before triggering them.
In that case the loadConfig is called before the languageCode plugin (no matter their order) and as a result sets the default language as the VM's language.
Now since you have the language as a static param in the vmText Class, it makes no difference if the Application's language is defined later by the languageCode system plugin. It is already defined for VM in the 1st call.

Question:
What if the vmText gets the current language from the application instead of using a static variable?
$lang=\Joomla\CMS\Factory::getApplication()->getLanguage();
This seems to work independently of any plugin's code.
Also why not letting the application have responsibility of it's own variables?
This is a variable that affects the state of the entire application. It is not wise to store it statically in higher level.
Title: Re: [solved]update 3.6.8 10197 the categories and products do not change language
Post by: Studio 42 on November 29, 2019, 17:35:27 PM
The plugin is not "languageCode plugin" but "System - Language Filter".
You need to order this plugin first in the list.