]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
po: added a needstranslation() pagespec
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index 86d5087f474f7be108239e3fe79f0c27506cd6e9..f12c69d5f58f5e33856bb8de128c6d13ffb7ad26 100644 (file)
@@ -1220,4 +1220,19 @@ sub match_currentlang ($$;@) {
        }
 }
 
+sub match_needstranslation ($$;@) {
+       my $page=shift;
+
+       my $percenttranslated=IkiWiki::Plugin::po::percenttranslated($page);
+       if ($percenttranslated eq 'N/A') {
+               return IkiWiki::FailReason->new("file is not a translation page");
+       }
+       elsif ($percenttranslated < 100) {
+               return IkiWiki::SuccessReason->new("file has $percenttranslated translated");
+        }
+       else {
+               return IkiWiki::FailReason->new("file is fully translated");
+       }
+}
+
 1