- @@ -489,4 +496,50 @@
- $hooks{$param{type}}{$param{id}}=\%param;
- } # }}}
-
- +sub get_preferred_locale() {
- + if (my $env = $ENV{LC_ALL}) {
- + return $env;
- + }
- +
- + my @avail=`locale -a`;
- + chomp @avail;
- +
- + return "POSIX" unless @avail;
- +
- + my @ret;
- + # prefer UTF-8 locales
- + @avail = map { my $l = $_; $l =~ s/\.utf8/\.UTF-8/; $l; } @avail;
- + @avail = @ret if @ret = grep(/\.UTF-8$/, @avail);
- +
- + # prefer en_US or en_ locales
- + return $ret[0] if @ret = grep(/^en_US/, @avail);
- + return $ret[0] if @ret = grep(/^en_/, @avail);
- + return $ret[0] if @ret = grep(/^[^.@]+$/, @avail);
- +
- + # fallback to the first locale found
- + return $avail[0];
- +} # }}}
- +
- +sub get_charset_from_locale($) {
- + my $locale=shift;
- + my ($l, $c);
- +
- + my $supportedlist = "/usr/share/i18n/SUPPORTED";
- + if (defined $locale and open(SUPPORTED, "< $supportedlist")) {
- + while (<SUPPORTED>) {
- + chomp;
- + ($l, $c) = split(/\s+/);
- + last if ($l eq $locale);
- + }
- + close(SUPPORTED);
- +
- + return $c if ($l eq $locale);
- + }
- + return "ISO-8859-1";
- +} # }}}
- +
- +sub decode_locale($) {
- + return decode(get_charset_from_locale($config{locale}), shift);
- +} # }}}
- +
- 1
+ Index: doc/ikiwiki.setup
+ ===================================================================
+ --- doc/ikiwiki.setup (revision 967)
+ +++ doc/ikiwiki.setup (working copy)
+ @@ -72,6 +72,9 @@
+ #exclude => qr/\*.wav/,
+ # Time format (for strftime)
+ #timeformat => '%c',
+ + # Locale to be used, useful for language customization of last-modified
+ + # time. WARNING: Must be a UTF-8 locale!
+ + #locale => 'en_US.UTF-8',
+
+ # To add plugins, list them here.
+ #add_plugins => [qw{meta tag pagecount brokenlinks search smiley
\ No newline at end of file