po plugin: slave pages link to the master's discussion page
Signed-off-by: intrigeri <intrigeri@boum.org>master
parent
9bd3262f50
commit
c7fbcf6c5e
|
@ -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 ($) { #{{{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue