diff options
author | intrigeri <intrigeri@boum.org> | 2008-11-03 01:35:58 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2008-11-03 01:35:58 +0100 |
commit | 265e857f6060b899ed6a08b5b28fe5190f056c0c (patch) | |
tree | 409fd192e80681f719c3a907b5a2f5912d6bd1d1 /IkiWiki | |
parent | 7b28deb171455a207e536b8abebbca67242a4588 (diff) | |
parent | 78155454a4d46c085e50937bda58bc4e2d40a648 (diff) |
Merge branch 'prv/po' into pub/po
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/po.pm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 0902322e3..9dda8c0db 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -134,6 +134,7 @@ sub refreshpot ($) { #{{{ # compulsory since this module prevents us from using the porefs option. my %po_options = ('porefs' => 'none'); $doc->{TT}{po_out}=Locale::Po4a::Po->new(\%po_options); + $doc->{TT}{po_out}->set_charset('utf-8'); # do the actual work $doc->parse; $doc->writepo($potfile); @@ -203,8 +204,8 @@ sub needsbuild () { #{{{ IkiWiki::refresh(); IkiWiki::saveindex(); # refresh module's private variables - %filtered=undef; - %translations=undef; + undef %filtered; + undef %translations; foreach my $page (keys %pagesources) { istranslation($page); } @@ -390,6 +391,7 @@ sub otherlanguages ($) { #{{{ sub pagetemplate (@) { #{{{ my %params=@_; my $page=$params{page}; + my $destpage=$params{destpage}; my $template=$params{template}; if (istranslation($page) && $template->query(name => "percenttranslated")) { @@ -416,6 +418,24 @@ sub pagetemplate (@) { #{{{ } } } + # Rely on IkiWiki::Render's genpage() to decide wether + # a discussion link should appear on $page; this is not + # totally accurate, though: some broken links may be generated + # when cgiurl is disabled. + # This compromise avoids some code duplication, and will probably + # prevent future breakage when ikiwiki internals change. + # Known limitations are preferred to future random bugs. + if ($template->param('discussionlink') && istranslation($page)) { + my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/); + $template->param('discussionlink' => htmllink( + $page, + $destpage, + $masterpage . '/' . gettext("Discussion"), + noimageinline => 1, + forcesubpage => 0, + linktext => gettext("Discussion"), + )); + } } # }}} sub istranslatable ($) { #{{{ |