Support » Networking WordPress » String not translated

  • Resolved Carmdq

    (@carmdq)


    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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    It’s probably the theme, and it didn’t translate all it’s strings :/

    What theme is this?

    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.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    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.

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    In your theme’s function.php file, yes.

    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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    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/ )

    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.]

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    $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.

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘String not translated’ is closed to new replies.