* Locale patch from Faidon:
[ikiwiki.git] / IkiWiki.pm
index 2b877a370d7f37a95147d9a7eb6bdd92ca3d3095..085953a17220fa50b44bf42892d7f0683f524d21 100644 (file)
@@ -49,9 +49,21 @@ sub defaultconfig () { #{{{
        adminemail => undef,
        plugin => [qw{mdwn inline htmlscrubber}],
        timeformat => '%c',
        adminemail => undef,
        plugin => [qw{mdwn inline htmlscrubber}],
        timeformat => '%c',
+       locale => undef,
 } #}}}
    
 sub checkconfig () { #{{{
 } #}}}
    
 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::LANG, $config{locale});
+       }
+
        if ($config{w3mmode}) {
                eval q{use Cwd q{abs_path}};
                $config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
        if ($config{w3mmode}) {
                eval q{use Cwd q{abs_path}};
                $config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));