summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-10-15 00:35:17 +0200
committerintrigeri <intrigeri@boum.org>2008-10-18 15:49:11 +0200
commitce9db8989655a71bba32159e0a342acc67a6451b (patch)
treeee2ef40db5dcbfc9cbcbc76d9e65b4affcc940fc /IkiWiki/Plugin
parentd07c6b707da7c22d6b744b8cf50e306766e11ba9 (diff)
po plugin: added lang() custom PageSpec function
Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/po.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 5abe9d419..05e57fab4 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -372,4 +372,26 @@ sub match_istranslatable ($;@) { #{{{
}
} #}}}
+sub match_lang ($$;@) { #{{{
+ my $page=shift;
+ my $wanted=shift;
+ my $regexp=IkiWiki::glob2re($wanted);
+ my $lang;
+ my $masterpage;
+
+ if (IkiWiki::Plugin::po::istranslation($page)) {
+ ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/);
+ }
+ else {
+ $lang = $config{po_master_language}{code};
+ }
+
+ if ($lang!~/^$regexp$/i) {
+ return IkiWiki::FailReason->new("file language is $lang, not $wanted");
+ }
+ else {
+ return IkiWiki::SuccessReason->new("file language is $wanted");
+ }
+} #}}}
+
1