summaryrefslogtreecommitdiff
path: root/libguile/i18n.c
diff options
context:
space:
mode:
authorMichael Gran <spk121@yahoo.com>2009-10-09 07:06:14 -0700
committerMichael Gran <spk121@yahoo.com>2009-10-09 07:06:14 -0700
commit03d80c0327de6e38dec6c3c64759e4011ed890a5 (patch)
tree2ef8c1c0971e7cfa092b8cdb12a951c5c5bcc418 /libguile/i18n.c
parent3d1af79fece43fa40665c5dae53afba048827d47 (diff)
downloadguile-03d80c0327de6e38dec6c3c64759e4011ed890a5.tar.gz
Revert changes that gather thread-specific local language
The method used was not portable. However, the underlying problem still exists: the uc_locale_language used by libunistring does not work with thread-specific locale_t locales. * libguile/i18n.c (locale_language): avoid unpacking semi-opaque type locale_t. * test-suite/tests/i18n.test: set Turkish string and char locale upcase and downcase tests to throw untested
Diffstat (limited to 'libguile/i18n.c')
-rw-r--r--libguile/i18n.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/libguile/i18n.c b/libguile/i18n.c
index 004db8d5e..7deb39536 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -779,44 +779,17 @@ compare_u32_strings (SCM s1, SCM s2, SCM locale, const char *func_name)
static const char *
locale_language ()
{
-#ifdef USE_GNU_LOCALE_API
- {
- static char lang[10];
- scm_t_locale loc;
- const char *c_result;
- char *p;
-
- /* If we are here, the locale has been set with 'uselocale'. We
- can't use libunistring's uc_locale_language because it calls
- setlocale. */
- loc = uselocale (0);
- if (loc == (scm_t_locale) -1)
- return "";
-
- /* The internal structure of locale_t may be specific to the C
- library, but, there doesn't seem to be any other way to extract
- the locale name. */
- c_result = loc->__names[LC_CTYPE];
- p = (char *) c_result;
- while (*p != '\0' && *p != '_' && *p != '.' && *p != '@')
- p++;
-
- /* Return a statically allocated pointer to the language portion,
- so that the caller of this function does not need to free() the
- result. */
- if (p != c_result)
- {
- memcpy (lang, c_result, p - c_result);
- lang[p - c_result] = '\0';
- return lang;
- }
- else
- return "";
- }
-#else
- /* The locale has been set with setlocale. */
+ /* FIXME: If the locale has been set with 'uselocale',
+ libunistring's uc_locale_language will return the incorrect
+ language: it will return the language appropriate for the global
+ (non-thread-specific) locale.
+
+ There appears to be no portable way to extract the language from
+ the thread-specific locale_t. There is no LANGUAGE capability in
+ nl_langinfo or nl_langinfo_l.
+
+ Thus, uc_locale_language needs to be fixed upstream. */
return uc_locale_language ();
-#endif
}
static inline int