[resolved] Translation ? (9 posts)

  1. Matthias Kohlhoff
    Posted 2 years ago #

    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!


  2. keesiemeijer
    Posted 2 years ago #

    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.


  3. bradthomas127
    Theme Author

    Posted 2 years ago #

    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

  4. Matthias Kohlhoff
    Posted 2 years ago #

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

  5. Nyanabhadra
    Posted 2 years ago #

    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!

  6. Nyanabhadra
    Posted 2 years ago #

    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,

  7. keesiemeijer
    Posted 2 years ago #

    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.

  8. Nyanabhadra
    Posted 2 years ago #

    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

  9. keesiemeijer
    Posted 2 years ago #

    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: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin
     * @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.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic


No tags yet.