]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
web commit by joey: fix format
[ikiwiki.git] / IkiWiki.pm
index 4964f97a1ad59797e34f745e8a9f01e50f73169d..d369d7da839589f3d440a47e083a241e3cf45389 100644 (file)
@@ -49,9 +49,21 @@ sub defaultconfig () { #{{{
        adminemail => undef,
        plugin => [qw{mdwn inline htmlscrubber}],
        timeformat => '%c',
+       locale => undef,
 } #}}}
    
 sub checkconfig () { #{{{
+       # locale stuff; avoid LC_ALL since it overrides everything
+       if (defined $ENV{LC_ALL}) {
+               $ENV{LANG} = $ENV{LC_ALL};
+               delete $ENV{LC_ALL};
+       }
+       if (defined $config{locale}) {
+               eval q{use POSIX};
+               $ENV{LANG} = $config{locale}
+                       if POSIX::setlocale(&POSIX::LC_TIME, $config{locale});
+       }
+
        if ($config{w3mmode}) {
                eval q{use Cwd q{abs_path}};
                $config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
@@ -81,6 +93,14 @@ sub checkconfig () { #{{{
                require IkiWiki::Rcs::Stub;
        }
 
+       if (exists $hooks{checkconfig}) {
+                foreach my $id (keys %{$hooks{checkconfig}}) {
+                        $hooks{checkconfig}{$id}{call}->();
+                }
+        }
+} #}}}
+
+sub loadplugins () { #{{{
        foreach my $plugin (@{$config{plugin}}) {
                my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
                eval qq{use $mod};
@@ -88,12 +108,6 @@ sub checkconfig () { #{{{
                        error("Failed to load plugin $mod: $@");
                }
        }
-
-       if (exists $hooks{checkconfig}) {
-                foreach my $id (keys %{$hooks{checkconfig}}) {
-                        $hooks{checkconfig}{$id}{call}->();
-                }
-        }
 } #}}}
 
 sub error ($) { #{{{