From a7d329c17312348d7511b48523fb54c18f8d4736 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 10 Nov 2008 21:30:06 +0100 Subject: po(match_lang, match_currentlang): use the lang() function ... now that it exists, instead of duplicating it. Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'IkiWiki/Plugin/po.pm') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 1754260ed..2ffccb7e0 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -726,16 +726,7 @@ sub match_lang ($$;@) { #{{{ 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}; - } - + my $lang=IkiWiki::Plugin::po::lang($page); if ($lang!~/^$regexp$/i) { return IkiWiki::FailReason->new("file language is $lang, not $wanted"); } @@ -746,26 +737,13 @@ sub match_lang ($$;@) { #{{{ sub match_currentlang ($$;@) { #{{{ my $page=shift; - shift; my %params=@_; - my ($currentmasterpage, $currentlang, $masterpage, $lang); return IkiWiki::FailReason->new("no location provided") unless exists $params{location}; - if (IkiWiki::Plugin::po::istranslation($params{location})) { - ($currentmasterpage, $currentlang) = ($params{location} =~ /(.*)[.]([a-z]{2})$/); - } - else { - $currentlang = $config{po_master_language}{code}; - } - - if (IkiWiki::Plugin::po::istranslation($page)) { - ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/); - } - else { - $lang = $config{po_master_language}{code}; - } + my $currentlang=IkiWiki::Plugin::po::lang($params{location}); + my $lang=IkiWiki::Plugin::po::lang($page); if ($lang eq $currentlang) { return IkiWiki::SuccessReason->new("file language is the same as current one, i.e. $currentlang"); -- cgit v1.2.3