]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po plugin: name rendered master pages like slave ones (page.html.LL)
authorintrigeri <intrigeri@boum.org>
Tue, 7 Oct 2008 20:08:28 +0000 (22:08 +0200)
committerintrigeri <intrigeri@boum.org>
Sat, 18 Oct 2008 13:49:07 +0000 (15:49 +0200)
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 <intrigeri@boum.org>
IkiWiki/Plugin/po.pm
doc/plugins/po.mdwn

index 351b9c1550ad3b7231cfa113f2c5dc6262698d15..941f5629d0d0a14102c4cb9ee000a814815177f4 100644 (file)
@@ -51,16 +51,22 @@ sub targetpage (@) { #{{{
         my $page=$params{page};
         my $ext=$params{ext};
 
         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 {
        }
        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};
+               }
        }
 } #}}}
 
        }
 } #}}}
 
index 6690e5deaf15adeea14ff907ab167aac2c41f7ec..326a6f39fcd64af9536788feea4f9973b5176a93 100644 (file)
@@ -15,7 +15,7 @@ a "master" page, and is written in any supported format but PO.
 
 Example: `bla/page.mdwn` is a "master" Markdown page written in
 English; if `usedirs` is enabled, it is rendered as
 
 Example: `bla/page.mdwn` is a "master" Markdown page written in
 English; if `usedirs` is enabled, it is rendered as
-`bla/page/index.html`, else as `bla/page.html`.
+`bla/page/index.html.en`, else as `bla/page.html.en`.
 
 Translations of a "master" page into a "slave" language are called
 "slave" pages, and is a in gettext PO format. PO is thus promoted to
 
 Translations of a "master" page into a "slave" language are called
 "slave" pages, and is a in gettext PO format. PO is thus promoted to
@@ -56,9 +56,10 @@ default Debian Apache configuration.
 When `usedirs` is enabled, one has to set `DirectoryIndex index` for
 the wiki context.
 
 When `usedirs` is enabled, one has to set `DirectoryIndex index` for
 the wiki context.
 
-Setting `DefaultLanguage LL` for the wiki context can be needed, to
-ensure `bla/page/index.html` is served as `Content-Language: LL`
-(replace `LL` with your default MIME language).
+Setting `DefaultLanguage LL` (replace `LL` with your default MIME
+language) for the wiki context can be needed, to ensure
+`bla/page/index.html.en` is served as `Content-Language: LL`.
+**FIXME**: is it still needed with the new `.html.en` naming convention?
 
 lighttpd
 --------
 
 lighttpd
 --------