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 thread is resolved. Here is a description of the problem and solution.

Problem:
I added a few lines of custom code to the child theme and I want to be able to translate the values from get_theme_mod.

Solution:
Adding the following XML configuration to WPML → Settings → Custom XML Configuration did the trick:

<wpml-config>
    <admin-texts>
        <key name="theme_mods_entrada-child">
            <key name="label_for_overview"/>
            <key name="label_for_itinerary"/>
            <key name="label_for_accomodation"/>
            <key name="label_for_faqs"/>
            <key name="label_for_dates"/></key>
    </admin-texts>
</wpml-config>

This topic contains 5 replies, has 2 voices.

Last updated by Radu 2 months ago.

Assigned support staff: Radu.

Author Posts
August 14, 2019 at 12:55 pm #4394965

Boris

Hello,
this is very annoying! I posted a ticket this morning. I am used to having to wait a couple of hours at least for WPML to respond, which is ok for me. Apparently something has changed though, because I just saw an email that I did not respond to the chat (did not know you have any), and the ticket was closed. This is not the kind of support I am used to from WPML, closing a ticket when response takes a while. Come on guys!

Please re-open the ticket here: https://wpml.org/forums/topic/translated-strings-do-not-show-on-frontend/
So I don't have to enter all the information again.

Kind regards,
Boris Hoekmeijer

I am a contractor on your website (so very experienced with WPML), and for one of my clients (who has his own WPML license), I am setting up WPML properly. It's a website set up with the Entrada theme and WooCommerce. Entrada used to be WPML compatible, but it is no longer officially the case.
However, I have managed to get everything working properly. Except for one thing, which is what I'm hoping you can help me with:
- The product pages (example here: hidden link) have tabs at the bottom: overview, itinerary, accommodation, etc
- I've located the code for this, but strings were not functioning properly.
- I've made some changes to the code, now the strings show up fine in WPML string translation, and I've translated them. The code looks like this:

<?php
$assigned_class = 'assigned';
}
if( isset( $product_accommodation ) && !empty( $product_accommodation ) ) {
$active_class = ( $assigned_class == 'assigned' ) ? '' : 'class="active"';
$accomodation = get_theme_mod( 'label_for_accomodation');
if(!isset($accomodation) || empty($accomodation)){
$accomodation = _e('Accomodation','entrada');
}
?>

- Yet the strings do not show up on the front end.
- I entered wpml-config code in custom XML configuration, like this (but I am not sure this is correct):
<wpml-config>
<custom-fields>
<custom-field action="translate">Overview</custom-field>
<custom-field action="translate">Itinerary</custom-field>
<custom-field action="translate">Accommodation</custom-field>
<custom-field action="translate">FAQs and Reviews</custom-field>
<custom-field action="translate">Dates and Prices</custom-field>
</custom-fields>
</wpml-config>

End result is the translations are still not showing up on the frontend. Can you help me fix this?

I have no means to set up a test site for you, so I've created a backup (not with duplicator), so you can check on the live website (site access info provided below).

Thank you in advance.
Kind regards,
Boris Hoekmeijer

August 15, 2019 at 8:22 am #4399471

Boris

Hello,
can you please re-open my ticket from yesterday? If that is not possible, let me know and I will add the necessary information again in this ticket.
Regards,
Boris

August 15, 2019 at 8:52 am #4399727

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Boris,

I'm sorry for the misunderstanding from yesterday. I just had a look at the ticket you opened yesterday and I could see that it was a chat with my colleague Lauren. She closed that ticket because it was a chat one and it didn't get any reply back from you.

However, now that we're talking on this ticket (not chat), you can send me again the credentials for the website and I'll have a look. I'm sure that we'll be able to sort this out together.

The next reply is set to be private so you can safely send me the credentials.

Thanks,
Radu

August 15, 2019 at 10:16 am #4400221

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Boris,

The chat is the new method of talking with our support. It's pretty new and we're trying to offer faster support through it.

Can you go again to WPML → String translation and add the translation for the new elements available, please? I just created again the XML configuration and the new strings should be visible.

Thanks,
Radu

August 15, 2019 at 10:26 am #4400231

Boris

Hi Radu,
wow, yes it works now!! You're fast, thank you! 🙂
Can you help me understand better what you did so I will be able to do it myself in the future?
- is the "admin_texts_theme_mods_entrada-child" key name a random choice or is this the title for a specific reason?
- why is it added in admin-texts when it only appears on the front end?

Thank you for resolving it so quickly!
Regards,
Boris

August 15, 2019 at 10:45 am #4400375

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Boris,

I'm glad I could help! Maybe next time we'll have the chance of talking in chat.

You can have a look at the code I added to Dashboard → WPML → Settings → Custom XML Configuration tab.
Basically, the theme mods will aways appear under theme_mods_themename (in this case, theme_mods_entrada-child).
As for the admin-texts, this means that strings are set in the admin area. The naming is not actually that important 🙂

Wish you a great day,
Radu