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 5 replies, has 2 voices.

Last updated by fredericC-6 4 years, 9 months ago.

Assigned support staff: Bruno.

Author Posts
September 4, 2014 at 4:27 pm #464006

fredericC-6

Hi,
I'm using Multilingual Blog and WordPress 3.9.2
That the first time i use WPML and i don't no the best way to proceed.

I've translated page and menu, that's ok, but i need now to translate Widget

I'm using Olark for chat on a Widget with this code :

 
<a href="void(0);"">
     Click here to chat!
</a>

I just want to translate "Click here to chat!" on other langage

How to proceed ?

September 4, 2014 at 6:57 pm #464077

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

You need to do this manually. Please try this one:

<a href=""void(0);"">
<?php
if( ICL_LANGUAGE_CODE == 'en' ) { //english
     echo 'Click here to chat!';
} else { //text in second language
     echo 'Click here to chat! - SECOND LANGUAGE';
}
?>
</a>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Thank you.

September 5, 2014 at 11:09 am #464463

fredericC-6

Dear Bruno,
First, thanks for your Help.
In this Widget box, i tink i can write a javascript script, not php
I've try this :

<a href="void(0);"">
    <SCRIPT LANGUAGE="Javascript">
<!--
document.write("Click here to chat! 1");
//-->
</SCRIPT>

<?php
echo "Click here to chat! 2") ;
?>
</a>

"Click here to chat! 1" is working; but "Click here to chat! 2" does not appear

Do you think it's possile to use a javascript in place of PHP ?

Thanks
Fred

September 8, 2014 at 10:52 am #465587

fredericC-6

Hi,
Is it possible to do the same code whith a Javascript ?

September 8, 2014 at 8:31 pm #466139

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Sorry for the delay. If javascript is within PHP, you can use this:

<a href=""void(0);"">
<SCRIPT LANGUAGE="Javascript">
<!--
document.write("<?php echo ( ICL_LANGUAGE_CODE == 'en' ) ? 'Click here to chat! 1 english' : 'Click here to chat second language'; ?>");
//-->
</SCRIPT>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Thank you.

September 9, 2014 at 12:46 pm #466724

fredericC-6

Hello,
if php does not work, the php include in javascript that can not work either!
but I finally changed the widget so that it is able to read the php
That's ok
Thanks a lot !