|
From: Bruno H. <br...@cl...> - 2011-08-24 07:16:37
|
Sam wrote:
> setlocale(5, "fr_FR") = NULL
This explains it.
> Apparently because "locale -a" does not list fr_FR.
But it will likely have the locale "fr_FR.UTF-8" (or "fr_FR.utf8"
which is the name under which it is stored on disk)?
I think the code in spvw_language.d lines 137..140 should be
changed from
setenv (LC_MESSAGES, locale, 1);
setlocale (LC_MESSAGES, locale);
to
char locale_utf8[32];
strcpy (locale_utf8, locale);
strcat (locale_utf8, ".UTF-8");
setenv (LC_MESSAGES, locale_utf8, 1);
if (setlocale (LC_MESSAGES, locale_utf8) == NULL) {
setenv (LC_MESSAGES, locale, 1);
setlocale (LC_MESSAGES, locale);
}
so that it tries first fr_FR.UTF-8 and then, if that fails, fr_FR.
By the way, in line 132, the Danish locale is "da_DK", not "da_DA",
> Does setlocale set errno? (the man page is silent).
No, setlocale simply returns NULL when it fails.
> I think init_language is called too early - before the memory is
> initialized, so we cannot signal lisp errors yet.
> I think it should be called via C_set_current_language after the memory
> is initialized and it should raise lisp errors on any failure
This is debatable. The usual approach with missing translations and missing
locales is to be lenient. If you signal an error, clisp will not start up at all,
and that is not useful for the user.
Bruno
|