]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
po: clarify code with some comments
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index 7bc702eca180bc54aaa9f9a872fa2c554a0c2ca6..9967e41586669b2860dfe8fbf2f3a0d88f8b5a9b 100644 (file)
@@ -496,7 +496,7 @@ sub pagetemplate (@) { #{{{
                elsif (istranslation($page)) {
                        add_depends($page, $masterpage);
                        foreach my $translation (values %{$translations{$masterpage}}) {
-                               add_depends($page, $translation);
+                               add_depends($page, $translation) unless $page eq $translation;
                        }
                }
        }
@@ -517,7 +517,9 @@ sub pagetemplate (@) { #{{{
                                                        linktext => gettext("Discussion"),
                                                        ));
        }
-       # remove broken parentlink to ./index.html on home page's translations
+       # Remove broken parentlink to ./index.html on home page's translations.
+       # It works because this hook has the "last" parameter set, to ensure it
+       # runs after parentlinks' own pagetemplate hook.
        if ($template->param('parentlinks')
            && istranslation($page)
            && $masterpage eq "index") {
@@ -535,6 +537,9 @@ sub change(@) { #{{{
                next unless istranslatable($page);
                my $file=srcfile($pagesources{$page});
                my $updated_pot_file=0;
+               # Only refresh Pot file if it does not exist, or if
+               # $pagesources{$page} was changed: don't if only the HTML was
+               # refreshed, e.g. because of a dependency.
                if ((grep { $_ eq $pagesources{$page} } @origneedsbuild)
                    || ! -e potfile($file)) {
                        refreshpot($file);