1

I have added a link on the footer of my page in the format

<a href="URL">Link</a>

I would like to allow wmpl to translate it in french and have tried scanning my theme but the link's text doesn't appear in the string translation manager in the dashboard.

After reading this: http://wpml.org/faq/language-setup/ I have tried wrapping the link in gettext but do not know how to add an href link into this line of Php:

How could I do that?

2 Answers 2

2

You need to put your strings in translatable format.

<a href="URL"><?php _e( 'Link', 'your-theme-text-domain'); ?></a>

Function reference: _e(), this one echoes the value, for assignment, use $my_string = __( 'String', 'text-domain' );.

Also, check the following documentation: WordPress_in_Your_Language#Introduction and WPML - Getting String Translation to Work.

2

Although @brasofilo already has given the correct answer, I would like to point out that WPML offers another way to displaying a link (to content within your website).

Say that you would like a link in the footer going to the About (with an ID of 3) page, you could code that as follows:

Using icl_link_to_element(ID, type, text, arguments, anchor):

<?php icl_link_to_element(3,'page',__('Read more about us', 'textdomain')); ?> More information on that via WPML.

Hope this helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.