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 1 reply, has 2 voices.

Last updated by Noman 7 months, 1 week ago.

Assigned support staff: Noman.

Author Posts
March 12, 2019 at 1:22 pm #3322463

richardD-40

Hola,

I need to translate strings of text, but they don't appear on WPML. Looking for them, they appear in funtions.php file. For example:

// Display the related posts section.
echo '<div class="related">';
echo '<h2 class="related-title">You might also enjoy...</h2>';
echo '<div class="related-posts-list" data-columns>' . $related . '</div>';
echo '</div>';

I need that the text "You might also enjoy..." can be translatable

The same case when I want to transalte "Secciones"
echo '<div class="hide-for-large">';

echo '<h3 class="title_categories">Secciones</h3>';

echo '<select id="despliega_categorias" class="" name="attribute_cat" data-attribute_name="attribute_categorie" data-show_option_none="yes">';

These two phrases do not appera either on WPML or in Loco Translate

March 13, 2019 at 7:00 am #3330169

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support.

- I have wrapped the strings in the gettext functions __() with a text domain like 'themedomain’.

1) Please replace this line:

echo '<h2 class="related-title">You might also enjoy...</h2>';

With:

echo '<h2 class="related-title">'.__('You might also enjoy...', 'themedomain').'</h2>';

2) Please replace this line:

echo '<h3 class="title_categories">Secciones</h3>';

With:

echo '<h3 class="title_categories">'.__('Secciones', 'themedomain').'</h3>';

- Please scan the theme from WPML >> Theme and plugins localization section.
- Then search strings from WPML >> String Translation and add it’s translation.

Please let me know if this resolves your issue or you need further assistance?

Thank you

The topic ‘[Closed] Translating hard coded text in funtions php’ is closed to new replies.