mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
fix handling of locales with LyX/Mac
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
80fbee4eba
commit
384da17690
@ -1,3 +1,13 @@
|
||||
2004-05-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* lyxrc.C: do not set user_email to a default value but use empty
|
||||
instead. The entry used to be translated, which does not work
|
||||
since at the point where lyxrc is constructed there is no
|
||||
translation service available
|
||||
|
||||
* messages.C (getLocaleDir): remove and use directly
|
||||
lyx_localedir() instead
|
||||
|
||||
2004-06-02 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
Fix crash caused by dereferencing null pointer 'exportdata' in
|
||||
|
@ -272,9 +272,6 @@ void LyXRC::setDefaults() {
|
||||
user_name = lyx::support::user_name();
|
||||
|
||||
user_email = lyx::support::user_email();
|
||||
|
||||
if (user_email.empty())
|
||||
user_email = _("email address unknown");
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,21 +21,6 @@ using std::string;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
namespace {
|
||||
|
||||
string const & getLocaleDir()
|
||||
{
|
||||
static string locale_dir;
|
||||
|
||||
if (locale_dir.empty()) {
|
||||
locale_dir = GetEnvPath("LYX_LOCALEDIR");
|
||||
if (locale_dir.empty())
|
||||
locale_dir = lyx_localedir();
|
||||
}
|
||||
return locale_dir;
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
#if 0
|
||||
|
||||
@ -55,7 +40,7 @@ public:
|
||||
//lyxerr << "Messages: language(" << l
|
||||
// << ") in dir(" << dir << ")" << std::endl;
|
||||
|
||||
cat_gl = mssg_gl.open(PACKAGE, loc_gl, getLocaleDir().c_str());
|
||||
cat_gl = mssg_gl.open(PACKAGE, loc_gl, lyx_localedir().c_str());
|
||||
|
||||
}
|
||||
|
||||
@ -99,8 +84,6 @@ public:
|
||||
//lyxerr << "Messages: language(" << l
|
||||
// << ") in dir(" << dir << ")" << std::endl;
|
||||
|
||||
bindtextdomain(PACKAGE, getLocaleDir().c_str());
|
||||
textdomain(PACKAGE);
|
||||
}
|
||||
|
||||
~Pimpl() {}
|
||||
@ -112,6 +95,8 @@ public:
|
||||
|
||||
char * old = strdup(setlocale(LC_ALL, 0));
|
||||
char * n = setlocale(LC_ALL, lang_.c_str());
|
||||
bindtextdomain(PACKAGE, lyx_localedir().c_str());
|
||||
textdomain(PACKAGE);
|
||||
const char* msg = gettext(m.c_str());
|
||||
setlocale(LC_ALL, old);
|
||||
free(old);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2004-05-04 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* path_defines.C.in (setLyxPaths): make sure that LyX/Mac can find
|
||||
its po files when moved around; set default user directory to
|
||||
~/Library/Preferences/LyX/ for LyX/Mac.
|
||||
(lyx_localedir): return the value that may have been computed in
|
||||
setLyXPaths
|
||||
|
||||
2004-05-27 Kayvan Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* Makefile.am (libsupport_la_SOURCES): remove reference to
|
||||
|
@ -40,6 +40,8 @@ string build_lyxdir_;
|
||||
// Store for the path to the user-level support files.
|
||||
string user_lyxdir_;
|
||||
|
||||
// Store for the path to the locale directory.
|
||||
string localedir_;
|
||||
|
||||
/* The absolute path to the system-level lyx support files.
|
||||
* (Make-time value.)
|
||||
@ -73,7 +75,10 @@ string const & top_srcdir()
|
||||
string const & lyx_localedir()
|
||||
{
|
||||
static string const ll = "%LOCALEDIR%";
|
||||
return ll;
|
||||
if (localedir_.empty())
|
||||
return ll;
|
||||
else
|
||||
return localedir_;
|
||||
}
|
||||
|
||||
|
||||
@ -287,6 +292,15 @@ bool setLyxPaths()
|
||||
lyxerr[Debug::INIT] << "System directory: '"
|
||||
<< system_lyxdir_ << '\'' << endl;
|
||||
|
||||
// This is true when we are running from a Mac OS X bundle
|
||||
// (for LyX/Mac)
|
||||
bool const inOSXBundle =
|
||||
system_lyxdir_ == NormalizePath(AddPath(binpath, "../Resources/")
|
||||
+ OnlyFilename(binname));
|
||||
if (inOSXBundle)
|
||||
lyxerr[Debug::INIT] << "Running from LyX/Mac bundle."
|
||||
<< endl;
|
||||
|
||||
//
|
||||
// Set PATH for LyX/Mac
|
||||
// LyX/Mac is a relocatable application bundle; here we add to
|
||||
@ -295,14 +309,32 @@ bool setLyxPaths()
|
||||
// needs to run latex, previewers, etc.
|
||||
//
|
||||
|
||||
if (system_lyxdir_ == NormalizePath(AddPath(binpath, "../Resources/")
|
||||
+ OnlyFilename(binname))) {
|
||||
const string newpath = GetEnv("PATH") + ":" + binpath
|
||||
+ ":/sw/bin:/usr/local/bin"
|
||||
+ ":/usr/local/teTeX/bin/powerpc-apple-darwin-current";
|
||||
lyx::support::putenv("PATH", newpath);
|
||||
lyxerr[Debug::INIT] << "Running from LyX/Mac bundle. "
|
||||
"Setting PATH to: " << GetEnv("PATH") << endl;
|
||||
if (inOSXBundle) {
|
||||
const string newpath = GetEnv("PATH") + ":" + binpath
|
||||
+ ":/sw/bin:/usr/local/bin"
|
||||
+ ":/usr/local/teTeX/bin/powerpc-apple-darwin-current";
|
||||
lyx::support::putenv("PATH", newpath);
|
||||
lyxerr[Debug::INIT] << "LyX/Mac: setting PATH to: "
|
||||
<< GetEnv("PATH") << endl;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Determine locale directory
|
||||
//
|
||||
if (!GetEnv("LYX_LOCALEDIR").empty()) {
|
||||
localedir_ = GetEnv("LYX_LOCALEDIR");
|
||||
lyxerr[Debug::INIT] << "LYX_LOCALEDIR=" << localedir_ << endl;
|
||||
} else if (inOSXBundle) {
|
||||
string const maybe_localedir =
|
||||
NormalizePath(AddPath(system_lyxdir_, "../locale"));
|
||||
FileInfo fi(maybe_localedir);
|
||||
if (fi.isOK() && fi.isDir()) {
|
||||
lyxerr[Debug::INIT]
|
||||
<< "LyX/Mac: setting locale directory to "
|
||||
<< maybe_localedir << endl;
|
||||
localedir_ = maybe_localedir;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -323,9 +355,13 @@ bool setLyxPaths()
|
||||
|
||||
// default behaviour
|
||||
if (user_lyxdir_.empty())
|
||||
user_lyxdir_ = AddPath(GetEnvPath("HOME"),
|
||||
string(".") + PACKAGE);
|
||||
explicit_userdir = false;
|
||||
if (inOSXBundle)
|
||||
user_lyxdir_ = AddPath(GetEnvPath("HOME"),
|
||||
"Library/Preferences/LyX");
|
||||
else
|
||||
user_lyxdir_ = AddPath(GetEnvPath("HOME"),
|
||||
string(".") + PACKAGE);
|
||||
explicit_userdir = false;
|
||||
}
|
||||
|
||||
lyxerr[Debug::INIT] << "User LyX directory: '"
|
||||
|
Loading…
Reference in New Issue
Block a user