From: intrigeri Date: Tue, 14 Oct 2008 22:05:52 +0000 (+0200) Subject: po plugin: make any slave page dependent on the corresponding master page X-Git-Tag: 3.15~434 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/d4f787ef528d9947473b4b99d1088b647d615200?ds=sidebyside po plugin: make any slave page dependent on the corresponding master page Signed-off-by: intrigeri --- diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index ca26101b7..5abe9d419 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -150,6 +150,13 @@ sub needsbuild () { #{{{ refreshpofiles(srcfile($file), map { srcfile($_) } @pofiles); } } + + # make existing translations depend on the corresponding master page + foreach my $master (keys %translations) { + foreach my $slave (values %{$translations{$master}}) { + add_depends($slave, $master); + } + } } #}}} sub targetpage (@) { #{{{ diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index 6b04afd72..06ecedc24 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -177,10 +177,9 @@ Committing changes to a "master" page must: this is done in the `needsbuild` hook; the updated PO files must then be put under version control -2. trigger a refresh of the corresponding HTML slave pages; this can - be implemented by making any "slave" page depend on the - corresponding "master" page. The `add_depends` function can achieve - this, if used in a **FIXME** hook. +2. trigger a refresh of the corresponding HTML slave pages: this is + achieved by making any "slave" page dependent on the corresponding + "master" page, in the `needsbuild` hook. Also, when the plugin has just been enabled, all the needed POT and PO files have to be created.