optimise gettext calls

master
Joey Hess 2009-08-13 21:04:19 -04:00
parent 46c2d66fd3
commit 159c0c043c
2 changed files with 4 additions and 2 deletions

View File

@ -28,9 +28,9 @@ sub preprocess (@) {
add_depends($params{page}, $params{pages});
my %broken;
my $discussion=gettext("Discussion");
foreach my $page (pagespec_match_list([keys %links],
$params{pages}, location => $params{page})) {
my $discussion=gettext("Discussion");
my %seen;
foreach my $link (@{$links{$page}}) {
next if $seen{$link};

View File

@ -348,6 +348,9 @@ sub preprocess_inline (@) {
}
my $template=HTML::Template->new(@params) unless $raw;
my $discussionlink=lc(gettext("Discussion"))
if $config{discussion};
foreach my $page (@list) {
my $file = $pagesources{$page};
my $type = pagetype($file);
@ -371,7 +374,6 @@ sub preprocess_inline (@) {
my $file = $pagesources{$page};
my $type = pagetype($file);
if ($config{discussion}) {
my $discussionlink=lc(gettext("Discussion"));
if ($page !~ /.*\/\Q$discussionlink\E$/ &&
(length $config{cgiurl} ||
exists $links{$page."/".$discussionlink})) {