summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-12 23:22:26 +0100
committerintrigeri <intrigeri@boum.org>2008-11-12 23:27:30 +0100
commit190c641c8a9c59fcd69f413853ef84e312658791 (patch)
treee19d77b9b1781ac513b5abda983e3d257f552a1e /IkiWiki/Plugin
parent36312b13b4eced4bc328ed09bb40307671490b35 (diff)
po(otherlanguages): return pages that should exist
... instead of already existing ones. This fixes the "missing otherlanguages links on master pages just created via the CGI" bug. Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/po.pm27
1 files changed, 16 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index a6342c74f..7039f3033 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -150,6 +150,7 @@ sub needsbuild () { #{{{
# a given master page was rendered because its source file was changed
@origneedsbuild=(@$needsbuild);
+ flushmemoizecache();
buildtranslationscache();
# make existing translations depend on the corresponding master page
@@ -568,20 +569,24 @@ sub islanguagecode ($) { #{{{
return ($code =~ /^[a-z]{2}$/);
} #}}}
-sub otherlanguages($) { #{{{
+sub otherlanguage ($$) { #{{{
+ my $page=shift;
+ my $code=shift;
+
+ return masterpage($page) if $code eq $config{po_master_language}{code};
+ return masterpage($page) . '.' . $code;
+} #}}}
+
+sub otherlanguages ($) { #{{{
my $page=shift;
my %ret;
- if (istranslatable($page)) {
- %ret = %{$translations{$page}} if defined $translations{$page};
- }
- elsif (istranslation($page)) {
- my $masterpage = masterpage($page);
- $ret{$config{po_master_language}{code}} = $masterpage;
- foreach my $lang (sort keys %{$translations{$masterpage}}) {
- next if $lang eq lang($page);
- $ret{$lang} = $translations{$masterpage}{$lang};
- }
+ return \%ret unless (istranslation($page) || istranslatable($page));
+ my $curlang=lang($page);
+ foreach my $lang
+ ($config{po_master_language}{code}, keys %{$config{po_slave_languages}}) {
+ next if $lang eq $curlang;
+ $ret{$lang}=otherlanguage($page, $lang);
}
return \%ret;
} #}}}