diff options
Diffstat (limited to 'IkiWiki/Plugin/po.pm')
-rw-r--r-- | IkiWiki/Plugin/po.pm | 22 |
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 |