]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po: added a needstranslation() pagespec
authorintrigeri <intrigeri@boum.org>
Tue, 29 Jun 2010 13:45:34 +0000 (15:45 +0200)
committerJoey Hess <joey@kitenet.net>
Sun, 4 Jul 2010 18:20:12 +0000 (14:20 -0400)
(cherry picked from commit b225fdc44d4b3d2853db622d59aed7b59788aeec)

IkiWiki/Plugin/po.pm
doc/ikiwiki/pagespec/po.mdwn

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
 1
index 40ed9efb663be68814f68e46b66887dbd9b4aa55..f8b398575bd56ec952999e97ab3c47435082a225 100644 (file)
@@ -11,6 +11,8 @@ wiki:
   specified as a ISO639-1 (two-letter) language code.
 * "`currentlang()`" - tests whether a page is written in the same
   language as the current page.
   specified as a ISO639-1 (two-letter) language code.
 * "`currentlang()`" - tests whether a page is written in the same
   language as the current page.
+* "`needstranslation()`" - tests whether a page needs translation
+  work. Only slave pages match this PageSpec.
 
 Note that every non-po page is considered to be written in
 `po_master_language`, as specified in `ikiwiki.setup`.
 
 Note that every non-po page is considered to be written in
 `po_master_language`, as specified in `ikiwiki.setup`.