]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po plugin: add correct dependencies on pages using OTHERLANGUAGES
authorintrigeri <intrigeri@boum.org>
Wed, 15 Oct 2008 05:12:28 +0000 (07:12 +0200)
committerintrigeri <intrigeri@boum.org>
Sat, 18 Oct 2008 13:49:13 +0000 (15:49 +0200)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm
doc/plugins/po.mdwn

index 716aa9151e873e1e838285c3c8c160e1ef4d74b3..9a25ff60263e0780a26bc875f91805e4764a1a66 100644 (file)
@@ -368,6 +368,18 @@ sub pagetemplate (@) { #{{{
        }
        if ($template->query(name => "otherlanguages")) {
                $template->param(otherlanguages => [otherlanguages($page)]);
+               if (istranslatable($page)) {
+                       foreach my $translation (values %{$translations{$page}}) {
+                               add_depends($page, $translation);
+                       }
+               }
+               elsif (istranslation($page)) {
+                       my ($masterpage, $curlang) = ($page =~ /(.*)[.]([a-z]{2})$/);
+                       add_depends($page, $masterpage);
+                       foreach my $translation (values %{$translations{$masterpage}}) {
+                               add_depends($page, $translation);
+                       }
+               }
        }
 } # }}}
 
index e8c6975b04de8ed4fbc2a20cfc5b16634293f5b3..b3c50a925a067cfc19d4d297d064bbc2ac730d09 100644 (file)
@@ -191,9 +191,9 @@ TODO
 OTHERLANGUAGES dependencies
 ---------------------------
 
-Pages using `OTHERLANGUAGES` must depend on any "master" and "slave"
-pages whose status is being displayed. It will trigger dependency
-loops; how to sort this out?
+Pages using `OTHERLANGUAGES` depend on any "master" and "slave" pages
+whose status is being displayed. It is supposed to trigger dependency
+loops, but no practical bugs were noticed yet.
 
 Should pages using the `OTHERLANGUAGES` template loop be declared as
 linking to the same page in other versions? To be rigorous, they