From: intrigeri Date: Mon, 13 Oct 2008 15:19:56 +0000 (+0200) Subject: po plugin: build %translations at scan time X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/ae827a43f84bf18f971ff891d1d4f8d0c19b043c po plugin: build %translations at scan time ... so that we can consider it as complete at preprocess time Signed-off-by: intrigeri --- diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index f29ad7a79..e06fd5043 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -19,6 +19,7 @@ memoize("_istranslation"); sub import { hook(type => "getsetup", id => "po", call => \&getsetup); hook(type => "checkconfig", id => "po", call => \&checkconfig); + hook(type => "scan", id => "po", call => \&scan); hook(type => "targetpage", id => "po", call => \&targetpage); hook(type => "tweakurlpath", id => "po", call => \&tweakurlpath); hook(type => "tweakbestlink", id => "po", call => \&tweakbestlink); @@ -89,6 +90,15 @@ sub checkconfig () { #{{{ push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/; } #}}} +sub scan (@) { #{{{ + my %params=@_; + my $page=$params{page}; + # let's build %translations, using istranslation's + # side-effect, so that we can consider it is complete at + # preprocess time + istranslation($page); +} #}}} + sub targetpage (@) { #{{{ my %params = @_; my $page=$params{page}; diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index b587c79c4..b702414c0 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -123,16 +123,6 @@ lighttpd unfortunately does not support content negotiation. TODO ==== -Optimization ------------- - -Pre-compute what can be early in the build process: - -- the list of translatable (master) pages -- for every translatable page, the list of slave pages - -... and/or memoize `istranslation`/`istranslatable` function calls. - Display available translations ------------------------------