X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/a0ac34607919eab8f25e5312366c9c06bcfb791b..6fc898df75223b93eba827847fd67934a65d7bee:/IkiWiki/Plugin/po.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 89bd99470..9967e4158 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -166,10 +166,10 @@ sub refreshpot ($) { #{{{ my $potfile=potfile($masterfile); my %options = ("markdown" => (pagetype($masterfile) eq 'mdwn') ? 1 : 0); my $doc=Locale::Po4a::Chooser::new('text',%options); - $doc->read($masterfile); $doc->{TT}{utf_mode} = 1; $doc->{TT}{file_in_charset} = 'utf-8'; $doc->{TT}{file_out_charset} = 'utf-8'; + $doc->read($masterfile); # let's cheat a bit to force porefs option to be passed to Locale::Po4a::Po; # this is undocument use of internal Locale::Po4a::TransTractor's data, # compulsory since this module prevents us from using the porefs option. @@ -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);