1 Background: some po translations (amongst which `fr.po`) translate "discussion" to an upper-cased word (in French: "Discussion").
2 By the way, this is wished e.g. in German, where such a noun has to be written with an upper-cased "D", but I can not see
3 the logic behind the added "D" in French.
5 Anyway, this gettext-translated word is used to name the discussion pages, as `$discussionlink` in `Render.pm` is
6 built from `gettext("discussion")`. In the same piece of code, a case-sensitive regexp that tests wether the page
7 being rendered is a discussion page is case-sensitive.
9 On the other hand, new discussion pages are created with a name built from `gettext("Discussion")` (please note the upper-cased
10 "D"). Such a new page name seems to be automagically downcased.
12 This leads to newly created discussion pages not being recognized as discussion pages by the
13 `$page !~ /.*\/\Q$discussionlink\E$/` regexp, so that then end with an unwanted discussion link.
15 A simple fix that seems to work is to make this regexp case-insensitive:
17 git diff IkiWiki/Render.pm
18 diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
19 index adae9f0..093c25b 100644
20 --- a/IkiWiki/Render.pm
21 +++ b/IkiWiki/Render.pm
22 @@ -77,7 +77,7 @@ sub genpage ($$) {
24 if ($config{discussion}) {
25 my $discussionlink=gettext("discussion");
26 - if ($page !~ /.*\/\Q$discussionlink\E$/ &&
27 + if ($page !~ /.*\/\Q$discussionlink\E$/i &&
28 (length $config{cgiurl} ||
29 exists $links{$page."/".$discussionlink})) {
30 $template->param(discussionlink => htmllink($page, $page, gettext("Discussion"), noimageinline => 1, forcesubpage => 1));
32 But the best way would be to avoid assuming implicitely that translators will translate "discussion" and "Discussion" the same way.