summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-10 21:30:06 +0100
committerintrigeri <intrigeri@boum.org>2008-11-10 21:30:06 +0100
commita7d329c17312348d7511b48523fb54c18f8d4736 (patch)
tree41fdc925381096a393063642ba059a8f1f3334b5 /IkiWiki/Plugin
parentb4ab0d0b9eae7b2204b8ea8e1ee70e63117b23ab (diff)
po(match_lang, match_currentlang): use the lang() function
... now that it exists, instead of duplicating it. Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin')
-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");