diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 1ae85c5232..6a75ee1f86 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2001-10-12 Jean-Marc Lasgouttes + + * filetools.C (i18nLibFileSearch): check also LANGUAGE and LC_ALL, + like GNU gettext does. + 2001-10-08 Jean-Marc Lasgouttes * filetools.C (AbsolutePath): Use os::is_absolute_path() (also in diff --git a/src/support/filetools.C b/src/support/filetools.C index 95f60c3436..e21eb0da48 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -292,7 +292,22 @@ string const i18nLibFileSearch(string const & dir, string const & name, string const & ext) { - string const lang = token(string(GetEnv("LANG")), '_', 0); + // this comment is from intl/dcigettext.c. We try to mimick this + // behaviour here. + /* The highest priority value is the `LANGUAGE' environment + variable. But we don't use the value if the currently + selected locale is the C locale. This is a GNU extension. */ + + string const lc_all = GetEnv("LC_ALL"); + string lang = GetEnv("LANGUAGE"); + if (lang.empty() || lc_all == "C") { + lang = lc_all; + if (lang.empty()) { + lang = GetEnv("LANG"); + } + } + + lang = token(lang, '_', 0); if (lang.empty() || lang == "C") return LibFileSearch(dir, name, ext);