diff options
-rw-r--r-- | IkiWiki/Plugin/po.pm | 19 | ||||
-rw-r--r-- | doc/plugins/po.mdwn | 13 |
2 files changed, 26 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 155af706f..9dda8c0db 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -391,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")) { @@ -417,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 ($) { #{{{ diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index 1a9144aee..1b240de1a 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -196,6 +196,13 @@ Also, when the plugin has just been enabled, or when a page has just been declared as being translatable, the needed POT and PO files are created, and the PO files are checked into version control. +Discussion pages +---------------- + +Discussion should happen in the language in which the pages are written for +real, *i.e.* the "master" one. If discussion pages are enabled, "slave" pages +therefore link to the "master" page's discussion page. + TODO ==== @@ -248,12 +255,6 @@ Use nice page titles from meta plugin in links, as inline already does. Which configuration settings are safe enough for websetup? -### Discussion pages - -Decide something, probably that "slave" pages, being only translations, don't -deserve a discussion page: the discussion should happen in the language in which -the pages are written for real, which is the "master" one. - ### parentlinks When the wiki home page is translatable, the parentlinks plugin sets |