Support » Theme: Leaf » Translation ?

  • I search for an easy way to translate this theme into german language. I installed the Plugin “CodeStyling Localization”, but I cannot find the Gettext (.mo or .po) to translate.

    I don’t want to do “search & replace” in the Files because I don’t want to change the theme itselve.

    Somebody hast got a solution? It would be fine!


Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator keesiemeijer


    Try it with this tutorial for the plugin.

    With the plugin you can add a language and create the .mo or .po files if they don’t exist.

    If you have scanned your theme with the plugin for translatable strings and there are words that are not in the list you have to do a search for the words in all your template files. Create a child theme and copy the files with the non translatable words over and translate them in your child theme.

    Theme Author bradthomas127


    You can use the leaf.pot file in leaf/languages/leaf.pot and use a program like PoEdit to make the .MO and .PO files. Translating WordPress

    Thanks for your replies.

    I forgot, that I have to create a new language for the leaf theme. Thanks @keesiemeijer for the tip!

    I hope, I will remember the tip the next time I need a localisation ;-))

    Dear @Marrhias,

    I’m also doing a bilingual, probaly trilingual (English, German, and Dutch). I don’t know whether how it works for the translation of the theme, I’m using polylang for the translation, of course not all the things got translated.

    If you don’t mind, do you think it is possible to share your German translation?

    Thank you bro!

    Dear all,

    This plugin works fine!

    CodeStyling Localization

    But, I don’t know why I could not translate the pagination, maybe Thomas can help 🙂

    Thank you,

    Moderator keesiemeijer


    Maybe the pagination is hardcoded in your theme (i.e. not a translateble string). Do a search for the pagination strings on all your theme template files.

    Usually pagination is done by WordPress or a plugin. Do you use a plugin for your pagination or do you use one of these functions?

    Try translating WordPress or the pagination plugin with CodeStyling Localization.

    Dear Keesienmeijer,

    Thank you so much for your suggestion, indeed I translated the WordPress and the theme already with CodeStyling Localization.

    Yeah, I think it was hardcoded, probably this can be a suggestion for the author.

    Once again, thank you

    Moderator keesiemeijer


    I’ve checked the theme and the pagination is indeed hardcoded. What you could do in the meantime is creating a child theme and create a file named functions.php in your child theme with this in it:

     * Display pagination when applicable
     * @Author: kriesi
     * @Link:
     * @uses get_pagenum_link
     * @since Leaf 1.0
    	function leaf_pagination($pages = '', $range = 5) {   /* handle pagination for post pages*/
    		$showitems = ($range * 2)+1;  
    		global $paged;
    		if(empty($paged)) $paged = 1;
    			if($pages == '') {
    				global $wp_query;
    				$pages = $wp_query->max_num_pages;
    				if(!$pages) {
    					$pages = 1;
    			if(1 != $pages)
    				echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";
    				if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>« First</a>";
    				if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>";
    				for ($i=1; $i <= $pages; $i++)
    					if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
    						 echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
    				if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a>";
    				if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>";
    				echo "</div>\n";
    	} //  leaf_pagination

    And edit it to your liking, or make the strings translatable (as it should be):

    This way your edits will not affect your site when updating the theme.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translation ?’ is closed to new replies.