• Resolved mahsaad

    (@mahsaad)


    Hello,

    I’m using Polylang (latest version 1.7.9) to build a muli-lang website along with your plugin (version 1.4.2)
    I believe there was no issue prior to upgrade wordpress to the latest version (4.3.1)

    The issue:

    When creating a section with 2 languages (English and French) and creating 2 menus for those languages, when assigning the section in each menu with the same section language respectively, it overwrites the section in the other menu language. Meaning

    If i have a Menu EN and a Menu FR and a Section, “Starter” (en), “Entrees” (FR)

    I assign the “Starter” section to the Menu EN and then go and assign “Entree” to the Menu FR

    After checking the menus, both of them they have the same section with the same language

    In this example the last section assigned to the menu will be the same in the other menu

    Meaning, Menu EN and FR will have the section in the same language: “Entree”

    Looking forward to hear back from you

    Regards,

    https://www.ads-software.com/plugins/food-and-drink-menu/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter mahsaad

    (@mahsaad)

    Hi mahsaad,

    I’ve run into this issue before with a previous customer. I’m not very familiar with Polylang but at the time I spent some time playing around with it and came up something that seemed to work, though it required an adjustment to the wpml-config.xml file.

    Here’s a new version of the wpml-config.xml file. You’ll need to upload this to your wp-content/plugins/food-and-drink-menu directory to overwrite the existing file. You’ll want to make sure you keep a backup of this file. You’ll need to do this each time the plugin is updated, unfortunately.

    I’ve copied my response from before below. Hopefully it will help you work out how to do this:

    —–

    I spent some time today playing with Polylang to see if I could figure this out. I was able to get it working, but it looks like it handles things a little bit differently than WPML. As a result, you’ll need to modify the wpml-config.xml file in /wp-content/plugins/food-and-drink-menu/. I’ve attached a copy of it modified for you.

    Once the file has changed, you may need to deactivate and reactivate Polylang. Then go to Settings > Permalink and click the save button to update permalinks.

    Here is the process I used which worked for me:

    1. Create the Menu Item and assign it to a section, eg – “My Section”.

    2. Go to Menu Items > Menu Sections and create a translation of that section in your second language.

    3. Go back to your original Menu Item and create a translation of that Menu Item. Assign it to the translated section in the second language.

    4. Now create a Menu in your first language. Assign the Menu Section of the corresponding language.

    5. Create a translation of that Menu in the second language. Assign the Menu Section of the second language to that Menu.

    When I followed these steps I was able to use the language switcher and all elements of the menu changed to their translated versions. Hopefully that will work for you.

    —–

    Thread Starter mahsaad

    (@mahsaad)

    Hi NateWr,

    Thanks for the reply.

    I’ve followed your instruction, and it solved the problem.

    Here’s a funny thing, after I deactivated / reactivated the Polylang plugin, i’ve noticed that there is a new version of it that was out today

    So i reverted back to the original wpml-config.xml file and tested it and it seems to be working too

    So i’m not sure if the update fixed the issue coincidentally or if it’s the cache playing tricks, so i tried with a different browser and it seems to be working too.

    Here’s the thing, yesterday i was trying the food and drink menu plugin with a new wordpress installation to figure out the problem, of course it didn’t work, but today, without replacing the xml file, it’s still not working even though it has the latest polylang version.

    So, could you verify from your side if the new polylang update fixes the issue without replacing the xml file, or still need to replace it?

    Just to make sure i’m not hallucinating ??

    Thanks again,

    Regards,

    HI mahsaad,

    I don’t think the Polylang update changed anything and you’ll probably still need to change the wpml-config.xml.

    The config file only effects how the data gets put in when adding or editing a menu. So probably what happened is that you fixed the menu inputs while the file was updated, then reverted, and the data stayed the same under the hood.

    In theory, if you never edit a menu, you may never need the changed wpml-config.xml file, but every time you make an edit you’ll need it.

    Does that make sense?

    Thread Starter mahsaad

    (@mahsaad)

    Hi NateWr,

    Thanks for the fast reply

    I see, so in other words, if i add a new section in the menu, i have to replace the xml file, correct?
    even if you have an update for the plugin, i believe i have to replace the xml file and re-organize the menu?

    Question 2: will there be a fix in the next release, or this is something purely from the polylang plugin side?

    Regards,

    Hi mahsaad,

    The modified wpml-config.xml file effects the data as it is being saved. I believe that, once saved, the data is pulled out of the database and presented without reference to this file.

    What that means is that the file is only needed when the menus are being added or edited.

    So what I think happened in your case, when you updated the plugin and things still worked with the original wpml-config.xml, is that you were just displaying the data — not modifying it. It appeared to work, but that’s only because you were looking at the system after it had already done it’s work.

    In the future, you’ll want to keep this modified wpml-config.xml file around. You’ll need to overwrite it with each update.

    Unfortunately, it seems that Polylang and WPML handle this bit differently. So if I was to change the default wpml-config.xml file in a future update, I’d be breaking the plugin for all the WPML users.

    To be honest, supporting multi-lingual implementations has been a bit of a nightmare because of things like this. I hope it will get better in the future but I can’t make any promises.

    Thread Starter mahsaad

    (@mahsaad)

    Hi NateWr,

    Thanks for the clarification, I understand.

    One last thing just to make sure i understand this correctly

    Even after replacing the xml file with the copy that you provided, do you mean that:

    whenever i add a new item/section or update an existing item/section in the menu, do i have to replace the xml file again? or does this apply to the Sections only, since only the sections are affected?

    As a matter of fact, with the new xml file, i’ve modified the existing menu, by adding a new section and a new item in the new section, after verifying it looks that it’s still working fine, what i mean is that i didn’t have to replace the xml file again after the menu modification, so it looks that i don’t have to replace the xml file again after menu updates.

    What do you think?

    Regards,

    Hi mahsaad,

    I think the modified XML file only needs to be in place when you edit a menu. That’s because this is where you assign menu sections to a menu, and this is the source of the original problem.

    Thread Starter mahsaad

    (@mahsaad)

    Thanks NateWr for the support

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Conflict assigning Section with different language in the menu’ is closed to new replies.