]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
po plugin: added and documented PERCENTTRANSLATED template variable
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index eee6d40583a0e99e8a14ecd20d1ef6fe537a1729..98c070481978a560d328ecc107dac4396d3a341e 100644 (file)
@@ -18,6 +18,7 @@ use Memoize;
 my %translations;
 memoize("istranslatable");
 memoize("_istranslation");
 my %translations;
 memoize("istranslatable");
 memoize("_istranslation");
+memoize("percenttranslated");
 
 sub import {
        hook(type => "getsetup", id => "po", call => \&getsetup);
 
 sub import {
        hook(type => "getsetup", id => "po", call => \&getsetup);
@@ -318,6 +319,9 @@ sub pagetemplate (@) { #{{{
         my $page=$params{page};
         my $template=$params{template};
 
         my $page=$params{page};
         my $template=$params{template};
 
+       if (istranslation($page) && $template->query(name => "percenttranslated")) {
+               $template->param(percenttranslated => percenttranslated($page));
+       }
        if ($template->query(name => "otherlanguages")) {
                $template->param(otherlanguages => [otherlanguages($page)]);
        }
        if ($template->query(name => "otherlanguages")) {
                $template->param(otherlanguages => [otherlanguages($page)]);
        }