po: added a needstranslation() pagespec
parent
dcd57dd5c9
commit
b225fdc44d
|
@ -1291,4 +1291,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
|
||||||
|
|
|
@ -11,6 +11,8 @@ wiki:
|
||||||
specified as a ISO639-1 (two-letter) language code.
|
specified as a ISO639-1 (two-letter) language code.
|
||||||
* "`currentlang()`" - tests whether a page is written in the same
|
* "`currentlang()`" - tests whether a page is written in the same
|
||||||
language as the current page.
|
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
|
Note that every non-po page is considered to be written in
|
||||||
`po_master_language`, as specified in `ikiwiki.setup`.
|
`po_master_language`, as specified in `ikiwiki.setup`.
|
||||||
|
|
Loading…
Reference in New Issue