Reply To: Translations WPML – Related Posts

#6105
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

I looked up all possible solution based on this WPML article.

Method 2 and 3 are the possibilities, probably method 2 is easier in our case. This means that the title must be hard coded and then translated on the WPML string translations interface.

Open up the wp-content/plugins/related-posts-pro/includes/views/rpp.shortcode.php file and go lines 15-17, where you should see this:

<?php if (isset($options["title_text"]) && $options["title_text"] != ""): ?>
    <legend><?php echo $options["title_text"]; ?></legend>
<?php endif; ?>

Change that code to something like:

<?php if (isset($options["title_text"]) && $options["title_text"] != ""): ?>
    <?php icl_register_string('related_posts_pro', 'Header title', 'Related Posts'); ?>
    <legend><?php echo icl_t('related_posts_pro', 'Header title', 'Related Posts'); ?></legend>
<?php endif; ?>

Now, refresh one of the frontend pages where the Related Posts Pro plugin is active a few times to get this string registered.
Then if you open the string translations submenu on WPML, you should be able to see this string and translate it: https://i.imgur.com/CpBCnA2.png

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)