From 45d08022bbb97f1731951402997fa343f82c1494 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 7 Oct 2008 22:08:28 +0200 Subject: po plugin: name rendered master pages like slave ones (page.html.LL) Apache's content negotiation transparently redirects any old URL (page.html) to the new one, depending on the client preferred language (i.e. a German browser will be fed with page.html.de). Transition to this naming convention is then really smooth. This naming convention allows one to deliberately display the master page, even if her browser is configured for another language. Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 351b9c155..941f5629d 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -51,16 +51,22 @@ sub targetpage (@) { #{{{ my $page=$params{page}; my $ext=$params{ext}; - if (! IkiWiki::PageSpec::match_istranslation($page, $page)) { - return; - } - - my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/); - if (! $config{usedirs} || $page eq 'index') { - return $masterpage.".".$ext.".".$lang; + if (IkiWiki::PageSpec::match_istranslation($page, $page)) { + my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/); + if (! $config{usedirs} || $page eq 'index') { + return $masterpage . "." . $ext . "." . $lang; + } + else { + return $masterpage . "/index." . $ext . "." . $lang; + } } else { - return $masterpage."/index.".$ext.".".$lang; + if (! $config{usedirs} || $page eq 'index') { + return $page . "." . $ext . "." . $config{po_master_language}{code}; + } + else { + return $page . "/index." . $ext . "." . $config{po_master_language}{code}; + } } } #}}} -- cgit v1.2.3