WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] String not translated (12 posts)

  1. Carmdq
    Member
    Posted 1 year ago #

    Hi, I'm setting up a multisite WordPress installation. It has a Spanish and English version. I've set the languages correctly for each blog, but I noticed that there are stings like "Read more" that are not translated in the Spanish Version. How can I fix this? Thanks in advance.

  2. It's probably the theme, and it didn't translate all it's strings :/

    What theme is this?

  3. Carmdq
    Member
    Posted 1 year ago #

    It's a theme from ThemeTrust. However, I googled a bit, and it seems that wordpress' core translation is not including "Read More". So, I assumed it was not theme related.

  4. Huh, you're right!

    You'll want something like this:

    function nattywp_continue_reading_link() {
    	return ' <a href="'. get_permalink() . '">' . __( 'Read more <span class="meta-nav">→</span>', 'nattywp' ) . '</a>';
    }

    Only you need to change nattywp to your theme... Ask ThemeTrust what the string is so you can edit it.

  5. Carmdq
    Member
    Posted 1 year ago #

    Hi Mika. So, are you saying that I should include this string in the theme, and not the wordpress core files?

  6. In your theme's function.php file, yes.

  7. Carmdq
    Member
    Posted 1 year ago #

    Well, there's a function more_link in the theme's function.php, but it doesn't look to the code you provided at all.
    Also I've already asked Theme Trust, but I just wanted to note that my site is multilingual, so while I want to translate the read more string, I also want to keep it in English for one version of the site.

    Can't I just add a string in the WP .mo files? Any light on how this terms get translated may point me in the right direction. Thanks

  8. That's what you'll be doing.

    That would make the string translatable (the issue is that the string isn't, from what I can tell, though you may want to hit up http://make.wordpress.org/polyglots/ )

  9. Carmdq
    Member
    Posted 1 year ago #

    I see. I'm still missing something though. Apparently it's the fourth line of this code:

    function more_link() {
    	global $post;
    	$more_link = '<p class="moreLink"><a href="'.get_permalink().'" title="'.get_the_title().'">';
    	$more_link .= '<span>Read More</span>';
    	$more_link .= '</a></p>';
    	echo $more_link;
    }

    But I'm not sure how to implement your solution, as I've made a few attempts and it's not working yet.

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  10. $more_link .= '<span>Read More</span>';

    should be

    $more_link .= '<span>' . __( 'Read more', 'nattywp') . '</span>';

    So you can either edit it directly (not suggested) or create your own function to replace that 'more_link()' function with your own.

  11. Carmdq
    Member
    Posted 1 year ago #

    Not sure I follow. After replacing that string, how do I tell WordPress that the tag needs translation? Thanks

  12. You'd be editing/making a .pot file for the theme. But if you can't do that (and that's understandable) then change it to this:

    $more_link .= '<span>MYREADMORE</span>';

    Where MYREADMORE is what you want.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.