summaryrefslogtreecommitdiff
path: root/doc/patchqueue
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 21:04:31 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-07-29 21:04:31 +0000
commit6a9e16374f1549c7e63c7cd1c0e6989b2fb32191 (patch)
tree3c4f17322b237920d37281248bfb08d42cb5266c /doc/patchqueue
parent48f9d393393709d8e998a9eb8d4095773ab185a1 (diff)
* Locale patch from Faidon:
- Adds a locale setting to setup files. - Proper local time, if the locale configuration option is used. - Support for UTF-8 (or ISO-8859-X) filenames in SVN. Before this patch, commiting (or even rcs_updating) on repositories with UTF-8 filenames was impossible.
Diffstat (limited to 'doc/patchqueue')
-rw-r--r--doc/patchqueue/locale_patch.mdwn102
1 files changed, 0 insertions, 102 deletions
diff --git a/doc/patchqueue/locale_patch.mdwn b/doc/patchqueue/locale_patch.mdwn
deleted file mode 100644
index 78e82f9ac..000000000
--- a/doc/patchqueue/locale_patch.mdwn
+++ /dev/null
@@ -1,102 +0,0 @@
-This v2 patch is a different approach after Joey's comments and some though.
-
-It achieves:
-
-1. Proper local time, if the locale configuration option is used,
-2. Support for UTF-8 (or ISO-8859-X) filenames in SVN. Before this
-patch, commiting (or even rcs_updating) on repositories with UTF-8
-filenames was impossible.
-
-The svn backend sets `LC_CTYPE` to the following, in order of preference:
-
-* The current locale, if it contains utf8/UTF-8,
-* The current locale with the string ".UTF-8" appended to it,
-* `en_US.UTF-8`/`en_GB.UTF-8` -- a bit hacky, but they're _very_ common and
- they can help avoiding a call to `locale -a`, which may not be available
- in the current system,
-* The first UTF-8 locale it encounters from `locale -a`. Note that `LC_CTYPE`
- is the same for every UTF-8 locale, so it doesn't matter which one will be used.
-
--- [[Faidon]]
-
-----
- Index: IkiWiki/Rcs/svn.pm
- ===================================================================
- --- IkiWiki/Rcs/svn.pm (revision 967)
- +++ IkiWiki/Rcs/svn.pm (working copy)
- @@ -4,11 +4,35 @@
- use warnings;
- use strict;
- use IkiWiki;
- +use POSIX qw(setlocale LC_CTYPE);
-
- package IkiWiki;
-
- my $svn_webcommit=qr/^web commit (by (\w+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/;
-
- +sub find_lc_ctype() {
- + my $current = setlocale(LC_CTYPE);
- +
- + # Respect current locale if it's a UTF-8 one
- + return $current if $current =~ m/UTF-?8$/i;
- +
- + # Make some obvious attempts to avoid calling `locale -a`
- + foreach my $locale ("$current.UTF-8", "en_US.UTF-8", "en_GB.UTF-8") {
- + return $locale if setlocale(LC_CTYPE, $locale);
- + }
- +
- + # Try to get all available locales and pick the first UTF-8 one if found
- + if (my @locale = grep(/UTF-?8$/i, `locale -a`)) {
- + chomp @locale;
- + return $locale[0] if setlocale(LC_CTYPE, $locale[0]);
- + }
- +
- + # fallback to the current locale
- + return $current;
- +
- +} # }}}
- +$ENV{LC_CTYPE} = $ENV{LC_CTYPE} || find_lc_ctype();
- +
- sub svn_info ($$) { #{{{
- my $field=shift;
- my $file=shift;
- Index: IkiWiki.pm
- ===================================================================
- --- IkiWiki.pm (revision 967)
- +++ IkiWiki.pm (working copy)
- @@ -49,9 +49,21 @@
- 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::LANG, $config{locale});
- + }
- +
- if ($config{w3mmode}) {
- eval q{use Cwd q{abs_path}};
- $config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
- 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