- hook(type => "checkconfig", id => "po", call => \&checkconfig);
+ hook(type => "checkconfig", id => "po", call => \&checkconfig,
+ last => 1);
hook(type => "needsbuild", id => "po", call => \&needsbuild);
hook(type => "scan", id => "po", call => \&scan, last => 1);
hook(type => "filter", id => "po", call => \&filter);
hook(type => "needsbuild", id => "po", call => \&needsbuild);
hook(type => "scan", id => "po", call => \&scan, last => 1);
hook(type => "filter", id => "po", call => \&filter);
inject(name => "IkiWiki::urlto", call => \&myurlto);
$origsubs{'cgiurl'}=\&IkiWiki::cgiurl;
inject(name => "IkiWiki::cgiurl", call => \&mycgiurl);
inject(name => "IkiWiki::urlto", call => \&myurlto);
$origsubs{'cgiurl'}=\&IkiWiki::cgiurl;
inject(name => "IkiWiki::cgiurl", call => \&mycgiurl);
- $origsubs{'rootpage'}=\&IkiWiki::rootpage;
- inject(name => "IkiWiki::rootpage", call => \&myrootpage);
+ if (IkiWiki->can('rootpage')) {
+ $origsubs{'rootpage'}=\&IkiWiki::rootpage;
+ inject(name => "IkiWiki::rootpage", call => \&myrootpage)
+ if defined $origsubs{'rootpage'};
+ }
$origsubs{'isselflink'}=\&IkiWiki::isselflink;
inject(name => "IkiWiki::isselflink", call => \&myisselflink);
}
$origsubs{'isselflink'}=\&IkiWiki::isselflink;
inject(name => "IkiWiki::isselflink", call => \&myisselflink);
}
else {
$master_language_code=$config{po_master_language}{code};
$master_language_name=$config{po_master_language}{name};
else {
$master_language_code=$config{po_master_language}{code};
$master_language_name=$config{po_master_language}{name};
foreach my $pair (@{$config{po_slave_languages}}) {
my ($code, $name)=splitlangpair($pair);
foreach my $pair (@{$config{po_slave_languages}}) {
my ($code, $name)=splitlangpair($pair);
- } keys %{$config{po_slave_languages}};
+ } keys %slavelanguages;
+ $config{po_slave_languages}=[
+ map { joinlangpair($_, $slavelanguages{$_}) } @slavelanguages
+ ]
if ($template->query(name => "istranslatable")) {
$template->param(istranslatable => istranslatable($page));
}
if ($template->query(name => "istranslatable")) {
$template->param(istranslatable => istranslatable($page));
}
+ my $lang_code = istranslation($page) ? lang($page) : $master_language_code;
+ if ($template->query(name => "lang_code")) {
+ $template->param(lang_code => $lang_code);
+ }
+ if ($template->query(name => "lang_name")) {
+ $template->param(lang_name => languagename($lang_code));
+ }
if (istranslation($page) || istranslatable($page)) {
my ($masterpage, $lang) = (masterpage($page), lang($page));
if (istranslation($page) || istranslatable($page)) {
my ($masterpage, $lang) = (masterpage($page), lang($page));
- if (! $config{usedirs} || $masterpage eq 'index') {
+ if (defined $filename) {
+ return $masterpage . "/" . $filename . "." . $lang . "." . $ext;
+ }
+ elsif (! $config{usedirs} || $masterpage eq 'index') {
- return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}");
+ if (defined $from) {
+ return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}");
+ }
+ else {
+ return $origsubs{'urlto'}->($to,$from,$absolute);
+ }
}
# avoid using our injected beautify_urlpath if run by cgi_editpage,
# so that one is redirected to the just-edited page rather than to the
}
# avoid using our injected beautify_urlpath if run by cgi_editpage,
# so that one is redirected to the just-edited page rather than to the
return 0 unless defined $masterpage && defined $lang
&& length $masterpage && length $lang
&& defined $pagesources{$masterpage}
return 0 unless defined $masterpage && defined $lang
&& length $masterpage && length $lang
&& defined $pagesources{$masterpage}
return (maybe_add_leading_slash($masterpage, $hasleadingslash), $lang)
if istranslatable($masterpage);
return (maybe_add_leading_slash($masterpage, $hasleadingslash), $lang)
if istranslatable($masterpage);
# how to disable options is not consistent across po4a modules
$options{includessi} = '';
$options{includeexternal} = 0;
# how to disable options is not consistent across po4a modules
$options{includessi} = '';
$options{includeexternal} = 0;
if (! defined $code || ! defined $name ||
! length $code || ! length $name) {
# not a fatal error to avoid breaking if used with web setup
if (! defined $code || ! defined $name ||
! length $code || ! length $name) {
# not a fatal error to avoid breaking if used with web setup