summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/po.pm28
1 files changed, 3 insertions, 25 deletions
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");