]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
po(scan): make more clear what's being done
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index 389d4e940b0e0839aa29b7234781227388e5b893..7deddf9abad71cd053dbb7e3887ccda9d556885d 100644 (file)
@@ -157,6 +157,10 @@ sub needsbuild () { #{{{
        }
 } #}}}
 
+# Massage the recorded state of internal links so that:
+# - it matches the actually generated links, rather than the links as written
+#   in the pages' source
+# - backlinks are consistent in all cases
 sub scan (@) { #{{{
        my %params=@_;
        my $page=$params{page};
@@ -183,9 +187,10 @@ sub scan (@) { #{{{
        elsif (! istranslatable($page) && ! istranslation($page)) {
                foreach my $destpage (@{$links{$page}}) {
                        if (istranslatable($destpage)) {
-                               map {
-                                       push @{$links{$page}}, $destpage . '.' . $_;
-                               } (keys %{$config{po_slave_languages}});
+                               # make sure any destpage's translations has
+                               # $page in its backlinks
+                               push @{$links{$page}},
+                                       values %{otherlanguages($destpage)};
                        }
                }
        }