[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gettext: locale.alias file not read with different TEXTDOMAINDIR
From: |
Ben Hochstedler |
Subject: |
gettext: locale.alias file not read with different TEXTDOMAINDIR |
Date: |
Tue, 28 Nov 2000 13:19:19 -0600 |
If the default, compiled in locale directory is not available,
gettext() will not succeed if $LANG/$LANGUAGE setting is not the
name of a directory under $TEXTDOMAINDIR. The attached patch
makes it so that the directory to which a domain is bound is
also searched for a locale.alias file if one isn't found in
the locale dir path.
You can see this bug by moving your /usr/share/locale directory
(or whatever the standard search directory is as reported by
gettext --help) to something else like /usr/share/locale.moved,
setting TEXTDOMAINDIR to /usr/share/locale.moved, and then
running gettext for a certain string like so:
% env TEXTDOMAINDIR=/usr/local/locale.moved LANGUAGE=deutsch \
gettext gettext "Unknown system error"
-Ben
--
Ben Hochstedler GE Medical Systems Information Technologies
address@hidden http://www.gemedicalsystems.com/
Phone: 414-362-3317 Fax: 414-362-3389 Dial-comm: 401-3317
Index: intl/finddomain.c
===================================================================
RCS file: /code/local_repository/gnu/gettext/intl/finddomain.c,v
retrieving revision 1.2
diff -u -r1.2 finddomain.c
--- intl/finddomain.c 2000/05/08 17:55:20 1.2
+++ intl/finddomain.c 2000/11/28 16:52:59
@@ -140,7 +140,7 @@
/* See whether the locale value is an alias. If yes its value
*overwrites* the alias name. No test for the original value is
done. */
- alias_value = _nl_expand_alias (locale);
+ alias_value = _nl_expand_alias (dirname, locale);
if (alias_value != NULL)
{
#if defined _LIBC || defined HAVE_STRDUP
Index: intl/loadinfo.h
===================================================================
RCS file: /code/local_repository/gnu/gettext/intl/loadinfo.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 loadinfo.h
--- intl/loadinfo.h 1999/10/29 17:44:57 1.1.1.1
+++ intl/loadinfo.h 2000/11/28 16:57:36
@@ -64,7 +64,8 @@
const char *filename, int do_allocate));
-extern const char *_nl_expand_alias PARAMS ((const char *name));
+extern const char *_nl_expand_alias PARAMS ((const char *dirname,
+ const char *name));
extern int _nl_explode_name PARAMS ((char *name, const char **language,
const char **modifier,
Index: intl/localealias.c
===================================================================
RCS file: /code/local_repository/gnu/gettext/intl/localealias.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 localealias.c
--- intl/localealias.c 1999/10/29 17:44:58 1.1.1.1
+++ intl/localealias.c 2000/11/28 17:07:33
@@ -150,13 +150,14 @@
const char *
-_nl_expand_alias (name)
+_nl_expand_alias (dirname, name)
+ const char *dirname;
const char *name;
{
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
struct alias_map *retval;
const char *result = NULL;
- size_t added;
+ size_t added, used_dirname;
#ifdef _LIBC
__libc_lock_lock (lock);
@@ -186,6 +187,7 @@
/* Perhaps we can find another alias file. */
added = 0;
+ used_dirname = 0;
while (added == 0 && locale_alias_path[0] != '\0')
{
const char *start;
@@ -199,6 +201,12 @@
if (start < locale_alias_path)
added = read_alias_file (start, locale_alias_path - start);
+
+ if (added == 0 && locale_alias_path[0] == '\0' && used_dirname == 0)
+ {
+ locale_alias_path = dirname;
+ used_dirname = 1;
+ }
}
}
while (added != 0);
- gettext: locale.alias file not read with different TEXTDOMAINDIR,
Ben Hochstedler <=