aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-29 04:38:40 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-29 04:38:40 +0000
commit912521ef0711204965aa2319d41c7741bd3f4f4c (patch)
treeb0a3d21ddfc0b7ca4a8deaa26135d7c3309d3471 /IkiWiki
parentd05d052bff599327cf43b6f00e337197f1d2ab18 (diff)
downloadikiwiki-912521ef0711204965aa2319d41c7741bd3f4f4c.tar
ikiwiki-912521ef0711204965aa2319d41c7741bd3f4f4c.tar.gz
* Initial work on internationalization of the program code. po/ikiwiki.pot
is available for translation. * Export gettext() from IkiWiki module.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm22
-rw-r--r--IkiWiki/Plugin/aggregate.pm26
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm2
-rw-r--r--IkiWiki/Plugin/fortune.pm2
-rw-r--r--IkiWiki/Plugin/googlecalendar.pm2
-rw-r--r--IkiWiki/Plugin/img.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm10
-rw-r--r--IkiWiki/Plugin/linkmap.pm2
-rw-r--r--IkiWiki/Plugin/mdwn.pm2
-rw-r--r--IkiWiki/Plugin/mirrorlist.pm4
-rw-r--r--IkiWiki/Plugin/openid.pm4
-rw-r--r--IkiWiki/Plugin/orphans.pm2
-rw-r--r--IkiWiki/Plugin/passwordauth.pm10
-rw-r--r--IkiWiki/Plugin/poll.pm4
-rw-r--r--IkiWiki/Plugin/polygen.pm6
-rw-r--r--IkiWiki/Plugin/search.pm6
-rw-r--r--IkiWiki/Plugin/shortcut.pm4
-rw-r--r--IkiWiki/Plugin/smiley.pm2
-rw-r--r--IkiWiki/Plugin/template.pm11
-rw-r--r--IkiWiki/Rcs/Stub.pm2
-rw-r--r--IkiWiki/Rcs/svn.pm2
-rw-r--r--IkiWiki/Render.pm26
-rw-r--r--IkiWiki/Setup.pm2
-rw-r--r--IkiWiki/Setup/Standard.pm8
-rw-r--r--IkiWiki/UserInfo.pm15
-rw-r--r--IkiWiki/Wrapper.pm12
26 files changed, 96 insertions, 94 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index a41349be5..511358ff5 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -45,8 +45,10 @@ sub page_locked ($$;$) { #{{{
my $locked_pages=userinfo_get($admin, "locked_pages");
if (pagespec_match($page, userinfo_get($admin, "locked_pages"))) {
return 1 if $nonfatal;
- error(htmllink("", "", $page, 1)." is locked by ".
- userlink($admin)." and cannot be edited.");
+
+ error(sprintf(gettext("%s is locked by %s and cannot be edited"),
+ htmllink("", "", $page, 1),
+ userlink($admin)));
}
}
@@ -134,7 +136,7 @@ sub cgi_signin ($$) { #{{{
$form->field(name => "do", type => "hidden");
if ($q->param("do") ne "signin" && !$form->submitted) {
- $form->text("You need to log in first.");
+ $form->text(gettext("You need to log in first."));
}
run_hooks(formbuilder_setup => sub {
@@ -242,7 +244,7 @@ sub cgi_prefs ($$) { #{{{
redirect($q, $config{url});
return;
}
- elsif ($form->submitted eq "Save Preferences" && $form->validate) {
+ elsif ($form->submitted eq 'Save Preferences' && $form->validate) {
foreach my $field (qw(email subscriptions locked_pages)) {
if (defined $form->field($field) && length $form->field($field)) {
userinfo_set($user_name, $field, $form->field($field)) || error("failed to set $field");
@@ -252,7 +254,7 @@ sub cgi_prefs ($$) { #{{{
set_banned_users(grep { ! is_admin($_) }
split(' ', $form->field("banned_users")));
}
- $form->text("Preferences saved.");
+ $form->text(gettext("Preferences saved."));
}
if (exists $hooks{formbuilder}) {
@@ -403,7 +405,7 @@ sub cgi_editpage ($$) { #{{{
$dir=~s![^/]+/+$!!;
if ((defined $form->field('subpage') && length $form->field('subpage')) ||
- $page eq 'discussion') {
+ $page eq gettext('discussion')) {
$best_loc="$from/$page";
}
else {
@@ -440,7 +442,7 @@ sub cgi_editpage ($$) { #{{{
options => \@page_locs, value => $best_loc);
$form->field(name => "type", type => 'select',
options => \@page_types);
- $form->title("creating ".pagetitle($page));
+ $form->title(sprintf(gettext("creating %s"), pagetitle($page)));
}
elsif ($form->field("do") eq "edit") {
page_locked($page, $session);
@@ -457,7 +459,7 @@ sub cgi_editpage ($$) { #{{{
$form->tmpl_param("page_select", 0);
$form->field(name => "page", type => 'hidden');
$form->field(name => "type", type => 'hidden');
- $form->title("editing ".pagetitle($page));
+ $form->title(sprintf(gettext("editing %s"), pagetitle($page)));
}
print $form->render(submit => \@buttons);
@@ -500,7 +502,7 @@ sub cgi_editpage ($$) { #{{{
$form->tmpl_param("page_select", 0);
$form->field(name => "page", type => 'hidden');
$form->field(name => "type", type => 'hidden');
- $form->title("editing $page");
+ $form->title(sprintf(gettext("editing %s"), $page));
print $form->render(submit => \@buttons);
return;
}
@@ -617,7 +619,7 @@ sub cgi (;$$) { #{{{
if (defined $session->param("name") && userinfo_get($session->param("name"), "banned")) {
print $q->header(-status => "403 Forbidden");
$session->delete();
- print "You are banned.";
+ print gettext("You are banned.");
cgi_savesession($session);
exit;
}
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 2a3f36fce..46cd3102c 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -58,7 +58,7 @@ sub preprocess (@) { #{{{
foreach my $required (qw{name url}) {
if (! exists $params{$required}) {
- return "[[aggregate plugin missing $required parameter]]";
+ return "[[".sprintf(gettext("aggregate plugin missing %s parameter"), $required)."]]";
}
}
@@ -86,7 +86,7 @@ sub preprocess (@) { #{{{
$feed->{lastupdate}=0 unless defined $feed->{lastupdate};
$feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts};
- $feed->{message}="new feed" unless defined $feed->{message};
+ $feed->{message}=gettext("new feed") unless defined $feed->{message};
$feed->{error}=0 unless defined $feed->{error};
$feed->{tags}=[];
while (@_) {
@@ -100,8 +100,9 @@ sub preprocess (@) { #{{{
return "<a href=\"".$feed->{url}."\">".$feed->{name}."</a>: ".
($feed->{error} ? "<em>" : "").$feed->{message}.
($feed->{error} ? "</em>" : "").
- " (".$feed->{numposts}." posts".
- ($feed->{newposts} ? "; ".$feed->{newposts}." new" : "").
+ " (".$feed->{numposts}." ".gettext("posts").
+ ($feed->{newposts} ? "; ".$feed->{newposts}.
+ " ".gettext("new") : "").
")";
} # }}}
@@ -202,13 +203,14 @@ sub expire () { #{{{
if ($feed->{expireage}) {
my $days_old = (time - $IkiWiki::pagectime{$item->{page}}) / 60 / 60 / 24;
if ($days_old > $feed->{expireage}) {
- debug("expiring ".$item->{page}." ($days_old days old)");
+ debug(sprintf(gettext("expiring %s (%s days old)"),
+ $item->{page}, $days_old));
$item->{expired}=1;
}
}
elsif ($feed->{expirecount} &&
$count >= $feed->{expirecount}) {
- debug("expiring ".$item->{page});
+ debug(sprintf(gettext("expiring %s"), $item->{page}));
$item->{expired}=1;
}
else {
@@ -231,12 +233,12 @@ sub aggregate () { #{{{
$feed->{newposts}=0;
$IkiWiki::forcerebuild{$feed->{sourcepage}}=1;
- debug("checking feed ".$feed->{name}." ...");
+ debug(sprintf(gettext("checking feed %s ..."), $feed->{name}));
if (! length $feed->{feedurl}) {
my @urls=XML::Feed->find_feeds($feed->{url});
if (! @urls) {
- $feed->{message}="could not find feed at ".$feed->{feedurl};
+ $feed->{message}=sprintf(gettext("could not find feed at %s"), $feed->{feedurl});
$feed->{error}=1;
debug($feed->{message});
next;
@@ -245,7 +247,7 @@ sub aggregate () { #{{{
}
my $f=eval{XML::Feed->parse(URI->new($feed->{feedurl}))};
if ($@) {
- $feed->{message}="feed crashed XML::Feed! $@";
+ $feed->{message}=gettext("feed crashed XML::Feed!")." ($@)";
$feed->{error}=1;
debug($feed->{message});
next;
@@ -268,8 +270,8 @@ sub aggregate () { #{{{
);
}
- $feed->{message}="processed ok at ".
- displaytime($feed->{lastupdate});
+ $feed->{message}=sprintf(gettext("processed ok at "),
+ displaytime($feed->{lastupdate}));
$feed->{error}=0;
}
} #}}}
@@ -309,7 +311,7 @@ sub add_page (@) { #{{{
$c++
}
$guid->{page}=$page;
- debug("creating new page $page");
+ debug(sprintf(gettext("creating new page %s"), $page));
}
$guid->{feed}=$feed->{name};
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index 6741f9081..e79ce1d81 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -33,7 +33,7 @@ sub preprocess (@) { #{{{
}
}
- return "There are no broken links!" unless @broken;
+ return gettext("There are no broken links!") unless @broken;
my %seen;
return "<ul>\n".join("\n", map { "<li>$_</li>" } grep { ! $seen{$_}++ } sort @broken)."</ul>\n";
} # }}}
diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm
index 4ff343e3a..3bab134be 100644
--- a/IkiWiki/Plugin/fortune.pm
+++ b/IkiWiki/Plugin/fortune.pm
@@ -15,7 +15,7 @@ sub preprocess (@) { #{{{
my $f = `fortune 2>/dev/null`;
if ($?) {
- return "[[fortune failed]]";
+ return "[[".gettext("fortune failed")."]]";
}
else {
return "<pre>$f</pre>\n";
diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm
index dc0df0ad3..7620384f5 100644
--- a/IkiWiki/Plugin/googlecalendar.pm
+++ b/IkiWiki/Plugin/googlecalendar.pm
@@ -19,7 +19,7 @@ sub preprocess (@) { #{{{
# Avoid XSS attacks..
my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
if (! defined $url || ! length $url) {
- return "[[googlecalendar failed to find url in html]]";
+ return "[[".gettext("googlecalendar failed to find url in html")."]]";
}
my ($height)=$params{html}=~m#height="(\d+)"#;
my ($width)=$params{html}=~m#width="(\d+)"#;
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 20893f56c..120326910 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -8,8 +8,6 @@ use strict;
use IkiWiki;
use Image::Magick;
-my $convert = 'convert';
-
my %imgdefaults;
sub import { #{{{
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 70b353ec5..eb21959f9 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -34,7 +34,7 @@ sub getopt () { #{{{
sub checkconfig () { #{{{
if (($config{rss} || $config{atom}) && ! length $config{url}) {
- error("Must specify url to wiki with --url when using --rss or --atom");
+ error(gettext("Must specify url to wiki with --url when using --rss or --atom"));
}
if ($config{rss}) {
push @{$config{wiki_file_prune_regexps}}, qr/\.rss$/;
@@ -94,7 +94,7 @@ sub preprocess_inline (@) { #{{{
@list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
}
else {
- return "unknown sort type $params{sort}";
+ return sprintf(gettext("unknown sort type %s"), $params{sort});
}
if (exists $params{skip}) {
@@ -365,7 +365,7 @@ sub pingurl (@) { #{{{
eval q{require RPC::XML::Client};
if ($@) {
- debug("RPC::XML::Client not found, not pinging");
+ debug(gettext("RPC::XML::Client not found, not pinging"));
return;
}
@@ -373,11 +373,11 @@ sub pingurl (@) { #{{{
defined(my $pid = fork) or error("Can't fork: $!");
return if $pid;
chdir '/';
- eval q{use POSIX ’setsid’};
+ eval q{use POSIX 'setsid'};
setsid() or error("Can't start a new session: $!");
open STDIN, '/dev/null';
open STDOUT, '>/dev/null';
- open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
+ open STDERR, '>&STDOUT' or error("Can't dup stdout: $!");
# Don't need to keep a lock on the wiki as a daemon.
IkiWiki::unlockwiki();
diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
index d7dffc941..e0c5fb475 100644
--- a/IkiWiki/Plugin/linkmap.pm
+++ b/IkiWiki/Plugin/linkmap.pm
@@ -96,7 +96,7 @@ sub genmap ($) { #{{{
waitpid $pid, 0;
$SIG{PIPE}="DEFAULT";
if ($sigpipe) {
- return "[[linkmap failed to run dot]]";
+ return "[[".gettext("linkmap failed to run dot")."]]";
}
return $ret;
diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index 625f77f21..c087f2b41 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -34,7 +34,7 @@ sub htmlize (@) { #{{{
}
else {
do "/usr/bin/markdown" ||
- error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+ error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
$markdown_sub=\&Markdown::Markdown;
}
}
diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm
index 104587f3a..216d870fd 100644
--- a/IkiWiki/Plugin/mirrorlist.pm
+++ b/IkiWiki/Plugin/mirrorlist.pm
@@ -19,8 +19,8 @@ sub pagetemplate (@) { #{{{
sub mirrorlist ($) { #{{{
my $page=shift;
- return "<p>Mirror".
- (keys %{$config{mirrorlist}} > 1 ? "s" : "").
+ return "<p>".
+ (keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")).
": ".
join(", ",
map {
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm
index 75f13f878..f43c4db7f 100644
--- a/IkiWiki/Plugin/openid.pm
+++ b/IkiWiki/Plugin/openid.pm
@@ -33,8 +33,8 @@ sub formbuilder_setup (@) { #{{{
label => "OpenID",
size => 30,
comment => '('.
- htmllink("", "", "OpenID", 1, 0, "What's this?")
- .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">Get an OpenID</a>" : "")
+ htmllink("", "", "OpenID", 1, 0, gettext("What's this?"))
+ .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">".gettext("Get an OpenID")."</a>" : "")
.')'
);
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 3a8a7954f..6ba37615e 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -38,7 +38,7 @@ sub preprocess (@) { #{{{
push @orphans, $page;
}
- return "All pages are linked to by other pages." unless @orphans;
+ return gettext("All pages are linked to by other pages.") unless @orphans;
return "<ul>\n".join("\n", map { "<li>".htmllink($params{page}, $params{destpage}, $_, 1)."</li>" } sort @orphans)."</ul>\n";
} # }}}
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index 1aac17a9e..7ffc12080 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -101,7 +101,7 @@ sub formbuilder_setup (@) { #{{{
}
else {
# First time settings.
- $form->field(name => "name", comment => "(use FirstnameLastName)");
+ $form->field(name => "name", comment => gettext("(use FirstnameLastName)"));
if ($session->param("name")) {
$form->field(name => "name", value => $session->param("name"));
}
@@ -141,10 +141,10 @@ sub formbuilder (@) { #{{{
'regdate' => time})) {
$form->field(name => "confirm_password", type => "hidden");
$form->field(name => "email", type => "hidden");
- $form->text("Account creation successful. Now you can Login.");
+ $form->text(gettext("Account creation successful. Now you can Login."));
}
else {
- error("Error creating account.");
+ error(gettext("Error creating account."));
}
}
elsif ($form->submitted eq 'Mail Password') {
@@ -165,9 +165,9 @@ sub formbuilder (@) { #{{{
From => "$config{wikiname} admin <$config{adminemail}>",
Subject => "$config{wikiname} information",
Message => $template->output,
- ) or error("Failed to send mail");
+ ) or error(gettext("Failed to send mail"));
- $form->text("Your password has been emailed to you.");
+ $form->text(gettext("Your password has been emailed to you."));
$form->field(name => "name", required => 0);
push @$buttons, "Mail Password";
}
diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm
index c040deb76..a3321a32e 100644
--- a/IkiWiki/Plugin/poll.pm
+++ b/IkiWiki/Plugin/poll.pm
@@ -61,7 +61,7 @@ sub preprocess (@) { #{{{
$ret.="<input type=\"hidden\" name=\"num\" value=\"$pagenum{$params{page}}\" />\n";
$ret.="<input type=\"hidden\" name=\"page\" value=\"$params{page}\" />\n";
$ret.="<input type=\"hidden\" name=\"choice\" value=\"$choice\" />\n";
- $ret.="<input type=\"submit\" value=\"vote\" />\n";
+ $ret.="<input type=\"submit\" value=\"".gettext("vote")."\" />\n";
}
$ret.="</p>\n<hr class=poll align=left width=\"$percent%\"/>\n";
if ($open && exists $config{cgiurl}) {
@@ -69,7 +69,7 @@ sub preprocess (@) { #{{{
}
}
if ($showtotal) {
- $ret.="<span>Total votes: $total</span>\n";
+ $ret.="<span>".gettext("Total votes:")." $total</span>\n";
}
return "<div class=poll>$ret</div>";
} # }}}
diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm
index 966b6cb51..63f6bf5db 100644
--- a/IkiWiki/Plugin/polygen.pm
+++ b/IkiWiki/Plugin/polygen.pm
@@ -29,7 +29,7 @@ sub preprocess (@) { #{{{
my $grmfile = '/usr/share/polygen/ita/polygen.grm';
if (! -d '/usr/share/polygen') {
- return "[[polygen not installed]]";
+ return "[[".gettext("polygen not installed")."]]";
}
find({wanted => sub {
if (substr($File::Find::name, -length($grammar)) eq $grammar) {
@@ -48,10 +48,10 @@ sub preprocess (@) { #{{{
}
if ($?) {
- $res="[[polygen failed]]";
+ $res="[[".gettext("polygen failed")."]]";
}
- # Strip trainling spaces and newlines so that we flow well with the
+ # Strip trailing spaces and newlines so that we flow well with the
# markdown text
$res =~ s/\s*$//;
return $res;
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index 942b94986..1b5c66716 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -31,7 +31,7 @@ sub getopt () { #{{{
sub checkconfig () { #{{{
foreach my $required (qw(url cgiurl)) {
if (! length $config{$required}) {
- error("Must specify $required when using the search plugin\n");
+ error(sprintf(gettext("Must specify %s when using the search plugin"), $required));
}
}
} #}}}
@@ -55,13 +55,13 @@ sub pagetemplate (@) { #{{{
} #}}}
sub delete (@) { #{{{
- debug("cleaning hyperestraier search index");
+ debug(gettext("cleaning hyperestraier search index"));
estcmd("purge -cl");
estcfg();
} #}}}
sub change (@) { #{{{
- debug("updating hyperestraier search index");
+ debug(gettext("updating hyperestraier search index"));
estcmd("gather -cm -bc -cl -sd",
map {
Encode::encode_utf8($config{destdir}."/".$_)
diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm
index e4a9ab1a6..9479306a8 100644
--- a/IkiWiki/Plugin/shortcut.pm
+++ b/IkiWiki/Plugin/shortcut.pm
@@ -21,13 +21,13 @@ sub preprocess_shortcut (@) { #{{{
my %params=@_;
if (! defined $params{name} || ! defined $params{url}) {
- return "[[shortcut missing name or url parameter]]";
+ return "[[".gettext("shortcut missing name or url parameter")."]]";
}
hook(type => "preprocess", no_override => 1, id => $params{name},
call => sub { shortcut_expand($params{url}, $params{desc}, @_) });
- return "shortcut $params{name} points to $params{url}";
+ return sprintf(gettext("shortcut %s points to %s"), $params{name}, $params{url});
} # }}}
sub shortcut_expand ($$@) { #{{{
diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm
index 0c6f5d427..85a719337 100644
--- a/IkiWiki/Plugin/smiley.pm
+++ b/IkiWiki/Plugin/smiley.pm
@@ -19,7 +19,7 @@ sub setup () { #{{{
}
if (! %smileys) {
- debug("failed to parse any smileys, disabling plugin");
+ debug(gettext("failed to parse any smileys, disabling plugin"));
return;
}
diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
index 095705604..23d9d65d8 100644
--- a/IkiWiki/Plugin/template.pm
+++ b/IkiWiki/Plugin/template.pm
@@ -16,17 +16,16 @@ sub preprocess (@) { #{{{
my %params=@_;
if (! exists $params{id}) {
- return "[[template missing id parameter]]"
+ return "[[".gettext("template missing id parameter")."]]";
}
my $template_page="templates/$params{id}";
add_depends($params{page}, $template_page);
my $template_file=$pagesources{$template_page};
- return "[[template ".
- htmllink($params{page}, $params{destpage}, $template_page).
- " not found]]"
- unless defined $template_file;
+ return sprintf(gettext("template %s not found"),
+ htmllink($params{page}, $params{destpage}, $template_page))
+ unless defined $template_file;
my $template;
eval {
@@ -43,7 +42,7 @@ sub preprocess (@) { #{{{
);
};
if ($@) {
- return "[[template failed to process: $@]]";
+ return "[[".gettext("template failed to process:")." $@]]";
}
foreach my $param (keys %params) {
diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm
index 087f2508c..03757758a 100644
--- a/IkiWiki/Rcs/Stub.pm
+++ b/IkiWiki/Rcs/Stub.pm
@@ -63,7 +63,7 @@ sub rcs_notify () {
sub rcs_getctime ($) {
# Optional, used to get the page creation time from the RCS.
- error "getctime not implemented";
+ error gettext("getctime not implemented");
}
1
diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm
index 848dfac3a..30020c1fc 100644
--- a/IkiWiki/Rcs/svn.pm
+++ b/IkiWiki/Rcs/svn.pm
@@ -203,7 +203,7 @@ sub rcs_recentchanges ($) { #{{{
sub rcs_notify () { #{{{
if (! exists $ENV{REV}) {
- error("REV is not set, not running from svn post-commit hook, cannot send notifications");
+ error(gettext("REV is not set, not running from svn post-commit hook, cannot send notifications"));
}
my $rev=int(possibly_foolish_untaint($ENV{REV}));
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 678075b82..30249b9bd 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -93,8 +93,8 @@ sub genpage ($$$) { #{{{
$template->param(historyurl => $u);
$actions++;
}
- if ($config{discussion} && (length $config{cgiurl} || exists $links{"$page/discussion"})) {
- $template->param(discussionlink => htmllink($page, $page, "Discussion", 1, 1));
+ if ($config{discussion} && (length $config{cgiurl} || exists $links{$page."/".gettext("discussion")})) {
+ $template->param(discussionlink => htmllink($page, $page, gettext("Discussion"), 1, 1));
$actions++;
}
@@ -157,7 +157,7 @@ sub scan ($) { #{{{
if ($config{discussion}) {
# Discussion links are a special case since they're
# not in the text of the page, but on its template.
- push @links, "$page/discussion";
+ push @links, $page."/".gettext("discussion");
}
$links{$page}=\@links;
@@ -224,7 +224,7 @@ sub refresh () { #{{{
elsif (! -d $_ && ! -l $_) {
my ($f)=/$config{wiki_file_regexp}/; # untaint
if (! defined $f) {
- warn("skipping bad filename $_\n");
+ warn(sprintf(gettext("skipping bad filename %s"), $_)."\n");
}
else {
$f=~s/^\Q$config{srcdir}\E\/?//;
@@ -244,7 +244,7 @@ sub refresh () { #{{{
elsif (! -d $_ && ! -l $_) {
my ($f)=/$config{wiki_file_regexp}/; # untaint
if (! defined $f) {
- warn("skipping bad filename $_\n");
+ warn(sprintf(gettext("skipping bad filename %s"), $_)."\n");
}
else {
# Don't add pages that are in the
@@ -284,7 +284,7 @@ sub refresh () { #{{{
my @del;
foreach my $page (keys %oldpagemtime) {
if (! $exists{$page}) {
- debug("removing old page $page");
+ debug(sprintf(gettext("removing old page %s"), $page));
push @del, $pagesources{$page};
$links{$page}=[];
$renderedfiles{$page}=[];
@@ -303,7 +303,7 @@ sub refresh () { #{{{
if (! exists $oldpagemtime{$page} ||
mtime(srcfile($file)) > $oldpagemtime{$page} ||
$forcerebuild{$page}) {
- debug("scanning $file");
+ debug(sprintf(gettext("scanning %s"), $file));
push @changed, $file;
scan($file);
}
@@ -312,7 +312,7 @@ sub refresh () { #{{{
# render changed and new pages
foreach my $file (@changed) {
- debug("rendering $file");
+ debug(sprintf(gettext("rendering %s"), $file));
render($file);
$rendered{$file}=1;
}
@@ -324,7 +324,7 @@ sub refresh () { #{{{
foreach my $page (keys %{$backlinks{$p}}) {
my $file=$pagesources{$page};
next if $rendered{$file};
- debug("rendering $file, which links to $p");
+ debug(sprintf(gettext("rendering %s, which links to %s"), $file, $p));
render($file);
$rendered{$file}=1;
}
@@ -341,7 +341,7 @@ sub refresh () { #{{{
next if $f eq $file;
my $page=pagename($file);
if (pagespec_match($page, $depends{$p})) {
- debug("rendering $f, which depends on $page");
+ debug(sprintf(gettext("rendering %s, which depends on %s"), $f, $page));
render($f);
$rendered{$f}=1;
last;
@@ -379,7 +379,7 @@ sub refresh () { #{{{
my $linkfile=$pagesources{$link};
if (defined $linkfile) {
next if $rendered{$linkfile};
- debug("rendering $linkfile, to update its backlinks");
+ debug(sprintf(gettext("rendering %s, to update its backlinks"), $linkfile));
render($linkfile);
$rendered{$linkfile}=1;
}
@@ -391,7 +391,7 @@ sub refresh () { #{{{
my $page=pagename($src);
foreach my $file (@{$oldrenderedfiles{$page}}) {
if (! grep { $_ eq $file } @{$renderedfiles{$page}}) {
- debug("removing $file, no longer rendered by $page");
+ debug(sprintf(gettext("removing %s, no longer rendered by %s"), $file, $page));
prune($config{destdir}."/".$file);
}
}
@@ -417,7 +417,7 @@ sub commandline_render () { #{{{
$file=~s/\Q$config{srcdir}\E\/?//;
my $type=pagetype($file);
- die "ikiwiki: cannot render $srcfile\n" unless defined $type;
+ die sprintf(gettext("ikiwiki: cannot render %s"), $srcfile)."\n" unless defined $type;
my $content=readfile($srcfile);
my $page=pagename($file);
$pagesources{$page}=$file;
diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm
index 2b4c76bd0..560bc798b 100644
--- a/IkiWiki/Setup.pm
+++ b/IkiWiki/Setup.pm
@@ -10,7 +10,7 @@ package IkiWiki;
sub setup () { # {{{
my $setup=possibly_foolish_untaint($config{setup});
delete $config{setup};
- open (IN, $setup) || error("read $setup: $!\n");
+ open (IN, $setup) || error(sprintf(gettext("cannot read %s: %s"), $setup, $!));
my $code;
{
local $/=undef;
diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm
index 77c164e34..1e65b23e3 100644
--- a/IkiWiki/Setup/Standard.pm
+++ b/IkiWiki/Setup/Standard.pm
@@ -35,7 +35,7 @@ sub setup_standard {
}
if (! $config{render} && (! $config{refresh} || $config{wrappers})) {
- debug("generating wrappers..");
+ debug(gettext("generating wrappers.."));
my @wrappers=@{$setup{wrappers}};
delete $setup{wrappers};
my %startconfig=(%config);
@@ -71,10 +71,10 @@ sub setup_standard {
}
elsif (! $config{refresh}) {
$config{rebuild}=1;
- debug("rebuilding wiki..");
+ debug(gettext("rebuilding wiki.."));
}
else {
- debug("refreshing wiki..");
+ debug(gettext("refreshing wiki.."));
}
loadplugins();
@@ -83,7 +83,7 @@ sub setup_standard {
loadindex();
refresh();
- debug("done");
+ debug(gettext("done"));
saveindex();
}
diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm
index d48b8071c..03d63cc23 100644
--- a/IkiWiki/UserInfo.pm
+++ b/IkiWiki/UserInfo.pm
@@ -125,14 +125,15 @@ sub send_commit_mails ($$$@) { #{{{
my $diff=$diffsub->();
my $message=$messagesub->();
- my $subject="update of $config{wikiname}'s ";
+ my $pagelist;
if (@changed_pages > 2) {
- $subject.="$changed_pages[0] $changed_pages[1] etc";
+ $pagelist="$changed_pages[0] $changed_pages[1] ...";
}
else {
- $subject.=join(" ", @changed_pages);
+ $pagelist.=join(" ", @changed_pages);
}
- $subject.=" by $user";
+ my $subject=sprintf(gettext("update of %s's %s by %s"),
+ $config{wikiname}, $pagelist, $user);
my $template=template("notifymail.tmpl");
$template->param(
@@ -146,11 +147,11 @@ sub send_commit_mails ($$$@) { #{{{
defined(my $pid = fork) or error("Can't fork: $!");
return if $pid;
setsid() or error("Can't start a new session: $!");
- eval q{use POSIX ’setsid’};
+ eval q{use POSIX 'setsid'};
chdir '/';
open STDIN, '/dev/null';
open STDOUT, '>/dev/null';
- open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
+ open STDERR, '>&STDOUT' or error("Can't dup stdout: $!");
unlockwiki(); # don't need to keep a lock on the wiki
@@ -162,7 +163,7 @@ sub send_commit_mails ($$$@) { #{{{
From => "$config{wikiname} <$config{adminemail}>",
Subject => $subject,
Message => $template->output,
- ) or error("Failed to send update notification mail");
+ );
}
exit 0; # daemon process done
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index a3ecccd5b..e761085fb 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -13,15 +13,15 @@ sub gen_wrapper () { #{{{
$config{destdir}=abs_path($config{destdir});
my $this=abs_path($0);
if (! -x $this) {
- error("$this doesn't seem to be executable");
+ error(sprintf(gettext("%s doesn't seem to be executable"), $this));
}
if ($config{setup}) {
- error("cannot create a wrapper that uses a setup file");
+ error(gettext("cannot create a wrapper that uses a setup file"));
}
my $wrapper=possibly_foolish_untaint($config{wrapper});
if (! defined $wrapper || ! length $wrapper) {
- error("wrapper filename not specified");
+ error(gettext("wrapper filename not specified"));
}
delete $config{wrapper};
@@ -59,7 +59,7 @@ EOF
$configstring=~s/"/\\"/g;
$configstring=~s/\n/\\\n/g;
- open(OUT, ">$wrapper.c") || error("failed to write $wrapper.c: $!");;
+ open(OUT, ">$wrapper.c") || error(sprintf(gettext("failed to write %s: %s"), "$wrapper.c", $!));;
print OUT <<"EOF";
/* A wrapper for ikiwiki, can be safely made suid. */
#define _GNU_SOURCE
@@ -94,14 +94,14 @@ $envsave
EOF
close OUT;
if (system("gcc", "$wrapper.c", "-o", $wrapper) != 0) {
- error("failed to compile $wrapper.c");
+ error(sprintf(gettext("failed to compile %s"), "$wrapper.c"));
}
unlink("$wrapper.c");
if (defined $config{wrappermode} &&
! chmod(oct($config{wrappermode}), $wrapper)) {
error("chmod $wrapper: $!");
}
- print "successfully generated $wrapper\n";
+ printf(gettext("successfully generated %s\n"), $wrapper);
} #}}}
1