From 773de05a7a1ee68d2bed173367cf5e716884945a Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 2 Nov 2008 21:35:52 +0100 Subject: po plugin: force utf-8 encoding in POT files Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 0902322e3..59d938d82 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); -- cgit v1.2.3 From 9bd3262f50eb3096482a24b0c15db47bce752c3d Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 2 Nov 2008 23:12:43 +0100 Subject: po plugin: replace %hash=undef with undef %hash Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 59d938d82..155af706f 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -204,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); } -- cgit v1.2.3 From c7fbcf6c5eab205d69ebdd18e5b5f142aea21e97 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 3 Nov 2008 00:52:27 +0100 Subject: po plugin: slave pages link to the master's discussion page Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 19 +++++++++++++++++++ doc/plugins/po.mdwn | 13 +++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'IkiWiki') 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 -- cgit v1.2.3