diff options
author | intrigeri <intrigeri@boum.org> | 2010-06-29 15:45:34 +0200 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-04 14:20:12 -0400 |
commit | be49679fe9235f0fe9a28dabf3d91c9ee173106f (patch) | |
tree | eee41019019c1dd97472cff23d1e5e2f1e2ddd8d | |
parent | 92ee5386acdff8cd0180be9397e7370f4ec25088 (diff) | |
download | ikiwiki-be49679fe9235f0fe9a28dabf3d91c9ee173106f.tar ikiwiki-be49679fe9235f0fe9a28dabf3d91c9ee173106f.tar.gz |
po: added a needstranslation() pagespec
(cherry picked from commit b225fdc44d4b3d2853db622d59aed7b59788aeec)
-rw-r--r-- | IkiWiki/Plugin/po.pm | 15 | ||||
-rw-r--r-- | doc/ikiwiki/pagespec/po.mdwn | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 86d5087f4..f12c69d5f 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -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 diff --git a/doc/ikiwiki/pagespec/po.mdwn b/doc/ikiwiki/pagespec/po.mdwn index 40ed9efb6..f8b398575 100644 --- a/doc/ikiwiki/pagespec/po.mdwn +++ b/doc/ikiwiki/pagespec/po.mdwn @@ -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. +* "`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`. |