Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
I am trying to: create two widgets, one in English and one in French.

Solution:
Just simply add the following XML config to the WPML → Settings → Custom XML Configuration tab:

<wpml-config>
    <admin-texts>
        <key name="widget_shapely_home_parallax">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
                <key name="button1"/>
                <key name="button1_link"/>
                <key name="button2"/>
                <key name="button2_link"/>
            </key>
        </key>
        <key name="widget_shapely-cats">
            <key name="*">
                <key name="title"/>
            </key>
        </key>
        <key name="widget_shapely_home_cfa">
            <key name="*">
                <key name="title"/>
                <key name="button"/>
                <key name="button_link"/>
            </key>
        </key>
        <key name="widget_shapely_home_contact">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
                <key name="phone"/>
                <key name="address"/>
                <key name="email"/>
            </key>
        </key>
        <key name="widget_shapely_home_portfolio">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
            </key>
        </key>
        <key name="widget_shapely_home_testimonial">
            <key name="*">
                <key name="title"/>
            </key>
        </key>
    </admin-texts>
</wpml-config>

then you'll be able to translate the strings of the widgets through the WPML → String Translation area, just like any other widget.

Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/
https://wpml.org/documentation/getting-started-guide/translating-widgets/

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 7 replies, has 2 voices.

Last updated by sylvieB-11 4 years, 3 months ago.

Assisted by: Radu.

Author Posts
September 6, 2021 at 6:42 pm #9534081

sylvieB-11

I am trying to: create two widgets, one in english and one in french.

Link to a page where the issue can be seen:

I expected to see: only the widget in the selected language

Instead, I got: the widget in english and in french displayed both at the same time on the same page in the resulting web site, for english and also for french, like if 'WPML Widget' did not work.

I checked and did exactly how it is explained here:
https://wpml.org/forums/topic/some-parts-of-home-page-widgets-are-translated-others-are-not/

I also checked that the first widget is set in "All languages", and the second widget in french is set in "french" language from the drop down menu on the widget. But this one does not remain saved when I check again, so this is probably what causes the issue.

I am using wordpress V5.8. Maybe 'WPML Widget' plugin is too old?

I am really blocked right now.

Thanks for any help.

September 7, 2021 at 5:19 am #9536087

Radu

Hey Sylvie,

Thank you for reaching out to the WPML support!

From your description, it sounds like everything is set up correctly so I would like to have a look at the dashboard area to see if I can spot what else might be causing this issue.
In this case, could you give me access to the dashboard area so I can have a closer look, please?
The next reply is set to be private so you can safely send me the credentials.

Thanks,
Radu

September 8, 2021 at 7:58 pm #9550777

Radu

Hey Sylvie,

The WPML Widgets is not a plugin created or managed by us.

I'm not sure how are the widgets from the Shapely theme working or how is the homepage template meant to work, but can you try to add only the widgets that you want to display in English through Appearance → Widgets → Homepage area, please?
Once you did this, please go to WPML → String Translation and look for all the text that you added inside the widgets and add the translation for them.

Basically, you would add the translation as explained here:
https://wpml.org/documentation/getting-started-guide/translating-widgets/

Please give this a try and tell me how it goes.

Thanks,
Radu

September 8, 2021 at 9:00 pm #9551155

sylvieB-11

Hello.

The WPML Widgets plugin was suggested by your support to overcome an issue that WPML has, which is that the secondary languages are mixed up (some texts in French and others in English). You can see that here below, and what worked for the OP was the WPML Widget plugin (which doesn't work for me):
https://wpml.org/forums/topic/some-parts-of-home-page-widgets-are-translated-others-are-not/#post-3221348

As you suggest it, I already tried to put the widget in English only, and to use the string translation of WPML without the WPML Widgets plugin. I managed to do it but the issue is that for some texts it is shown in French but others are in English. It is mixed up in the user rendering of it.
This was also the original OP issue, mentioned here:
https://wpml.org/forums/topic/some-parts-of-home-page-widgets-are-translated-others-are-not

For me it is fine without this WPML Widgets plugin, it is even better so that I don't need to redo several widgets, one per language.

So I removed the WMPL Widgets plugin on the test site and you can see on the following page this mix of english and french:
hidden link
The page should be displayed only in French, but you will see several sentences in english.

You can login again and see this behaviour.
The "string translation" domain for the Shapely homepage widgets is: admin_texts_widget_shapely_home_parallax.

Please look specifically at the "[widget_shapely_home_parallax][2]body_content" string name.

This field will show you that the French translation is done correctly, with the english as source, but it is rendered in English on this link which is the French version:
hidden link

That is the problem that the other OP and me are facing.

It seems that some "WHERE lang='fr'" is forgotten somewhere in the SQL request.

Can you please try to install the "Shapely" theme on a new WordPress install with WPML and try to reproduce this error on your side?
I am quite sure that you will get the same issue.

Regards.

September 9, 2021 at 11:28 am #9555477

Radu

Hey Sylvie,

For now, the Shapely theme is not a part of the WPML compatible themes list (https://wpml.org/theme) so there might be some compatibility issues here and there between this theme and WPML.
Basically, the theme wasn't tested by our compatibility team. When an author wants to make its theme compatible with WPML, he can apply for the Go Global program - https://wpml.org/documentation/support/go-global-program/.
We are ready to work with theme and plugin authors, but the request needs to come from the authors because we can't just test every theme or plugin out there.

Now, I was able to make the widgets from the homepage work well based on the translations that you added in the WPML → String Translation area. All I had to do is add a small XML config in WPML → Settings → Custom XML Configuration tab.

Please have a look at the French homepage.

Thanks,
Radu

September 10, 2021 at 1:57 pm #9563941

sylvieB-11

Hello.

Thank you very much for this explanation regarding the Shapely theme and that it is not really WPML compatible, and especially for this Custom XML Configuration for WPML that you made and provided here.
I tried it and it works with WPML for the shapely parallax widget! Thank you very much, that is really great!

I still had to update it a little bit so that it also accepts the second button of this widget to be translated.
At the same time, I also updated some other widgets of the Shapely theme, so that it is already more compatible with WPML, but I didn't test them.

I put it here as reference for others that might need it too, keeping in mind that it is not fully supported and that the Shapely team will have to provide a more complete and official XML configuration:

<wpml-config>
    <admin-texts>
        <key name="widget_shapely_home_parallax">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
                <key name="button1"/>
                <key name="button1_link"/>
                <key name="button2"/>
                <key name="button2_link"/>
            </key>
        </key>
        <key name="widget_shapely-cats">
            <key name="*">
                <key name="title"/>
            </key>
        </key>
        <key name="widget_shapely_home_cfa">
            <key name="*">
                <key name="title"/>
                <key name="button"/>
                <key name="button_link"/>
            </key>
        </key>
        <key name="widget_shapely_home_contact">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
                <key name="phone"/>
                <key name="address"/>
                <key name="email"/>
            </key>
        </key>
        <key name="widget_shapely_home_portfolio">
            <key name="*">
                <key name="title"/>
                <key name="body_content"/>
            </key>
        </key>
        <key name="widget_shapely_home_testimonial">
            <key name="*">
                <key name="title"/>
            </key>
        </key>
    </admin-texts>
</wpml-config>

Now I can use the Shapely theme as I need it with the above code, for the widgets that I use, and it works very nicely!

Thank you again for this great support that you provided!

September 10, 2021 at 2:16 pm #9564223

Radu

Hey Sylvie,

I'm glad to hear that the widget translation is working fine now and thank you for attaching the XML configuration here. This will definitely be helpful for other users.

I will mark this ticket as resolved now but if you ever have any other questions, feel free to open a new ticket and we'll take care of it in no time.

Regards,
Radu

September 11, 2021 at 10:39 am #9568313

sylvieB-11

Ok thank you.
Would it be possible please to include a reference to this topic on the https://wpml.org/forums/topic/some-parts-of-home-page-widgets-are-translated-others-are-not ticket so that people also see this solution?

Generally speaking, I think that WPML should try to make these XML configurations for some well-known themes like Shapely, also even if they are free.

That is a consideration for your managers, but do the math: Shapely theme has 50 000 + installations. If you count that at least 3% of them will need a translation in another language, this means 1500 potential customers that will try WPML and have a very bad experience and will be lost, or even that will not try the theme nor WPML because not advertised so.

Hence if WPML generates those configurations this would bring lot of customers in, and everybody wins with this situation.
You could also provide some start of configuration like you did here to the authors, telling them that they just need to finish them, and they will be more than happy to finish it. Or you can do it fully for them, and tell them that they have to adapt it afterwards if they change something to their widgets.
This would mean being pro active searching to make most themes compatible with WPML so that everyone knows that WPML will have all chances to be compatible with their theme, if the theme is installed more than 1000 times for example.

Hoping this brings ideas for this great WPML translation plugin that works really nicely.
Thanks!