honor LANGUAGE and LC_ALL for finding i18n files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2878 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-10-12 16:23:26 +00:00
parent df1613ed4a
commit f6f2cfad08
2 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-10-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* filetools.C (i18nLibFileSearch): check also LANGUAGE and LC_ALL,
like GNU gettext does.
2001-10-08 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* filetools.C (AbsolutePath): Use os::is_absolute_path() (also in

View File

@ -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);