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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

This topic contains 15 replies, has 4 voices, and was last updated by  oscarM-16 4 years, 9 months ago. The support staff assigned to this topic is sarah.n.

Author Posts
Author Posts
March 4, 2013 at 1:26 pm #108614

Sami

Hi. Lot's of themes use Theme Customizer nowadays and data can come from get_theme_mod. Let's say I have a theme and I use front page callout in my Theme Customizer. I can get the data with get_theme_mod( 'callout_text' ) but how do I translate that data (text string) in the front end?

March 4, 2013 at 2:09 pm #108638

sarah.n
Forum moderator

Supporter languages: English (English )

Hello Sami,

Theme customizations are saved in the options table so what you need to do is create a configuration file as shown here: http://wpml.org/documentation/support/language-configuration-files/

This will register the text strings for translation under the "String Translation" screen (requires the "WPML String Translation" add-on)

<wpml-config>
<admin-texts>
<key name="theme_mods_twentyeleven">
<key name="callout_text" />
</key>
</admin-texts>
</wpml-config>

Replace twentyeleven in the above with the value saved in get_option( 'stylesheet' ) in your options table.

Let me know how you get on with this.

March 4, 2013 at 3:20 pm #108669

Sami

Thanks.

Hmmm I can see and translate strings in the String translation but in the front end there is still original language.

I placed .xml file in my child theme root folder.

March 4, 2013 at 4:27 pm #108707

sarah.n
Forum moderator

Supporter languages: English (English )

Sami,

Can you please confirm that you are using the latest version of everything?

You can check the latest released versions under "My Account -> Downloads" on this site. Should there be a need to update, instructions to update can be found here: http://wpml.org/faq/install-wpml/#2

Let me know if the issue persists after the update.

March 4, 2013 at 4:31 pm #108709

Sami

Yes I just updated everything and all version numbers match the latest version.

March 4, 2013 at 4:35 pm #108713

Sami

And I made the updates before I created .xml file.

March 4, 2013 at 5:00 pm #108724

sarah.n
Forum moderator

Supporter languages: English (English )

Sami, I have sent you an email to request some further information that will help me assist you further.

March 4, 2013 at 8:53 pm #108812

Sami

Just a quick note. The same problem is with theme settings: I can see and translate strings in backend, but translations doesn't show up in front end. This is my test file in localhost.

<wpml-config>

<admin-texts>

<key name="theme_mods_foxnet2013">

<key name="callout_text" />

</key>

<key name="hopeareunus_theme_settings">

<key name="footer_insert" />

</key>

</admin-texts>

</wpml-config>

And in database table wp_icl_string_translations I can see those translations.

March 5, 2013 at 6:34 am #108877

sarah.n
Forum moderator

Supporter languages: English (English )

I got your email reply Sami with the temporary admin access, thanks!

I do need also temporary FTP login credentials so if you would kindly provide that by replying to the original email I would appreciate it. Thank you!

March 5, 2013 at 6:35 pm #109176

Sami

I found a compromise to my problem. I can use excerpt text in english page instead of get_theme_mod data.

I let you know if I find a solutions to original problem.

March 5, 2013 at 7:16 pm #109194

sarah.n
Forum moderator

Supporter languages: English (English )

Just in case someone else may find this thread and would like to know how to get Theme Mods registered to String Translation here's a solution:

Use icl_translate() to register and display the string.

echo icl_translate('Theme Mod', 'callout_text', get_theme_mod( 'callout_text' ));

This function requires WPML String Translation to be active (so don't expect it to work on installs without the add-on).

Make sure that the first parameter is always 'Theme Mod', the second the modification setting and the third the WordPress call get_theme_mod($name)

Hope this is useful to someone.

March 5, 2013 at 7:36 pm #109200

Sami

Thanks!

March 6, 2013 at 7:54 am #109315

sarah.n
Forum moderator

Supporter languages: English (English )

You are welcome 🙂

March 4, 2016 at 5:09 pm #830401

davideD-4

Hi, is this solution still working? I tried using that code but can't find theme customizer strings into String Translation 🙁

March 7, 2016 at 3:09 pm #831823

davideD-4

Great! It solved,
please user pay attention to nesting rules!

<key name="theme_mods_yourthemename">

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.