diff --git a/src/ChangeLog b/src/ChangeLog index b34a90f213..1f1bc12c43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2004-05-10 Jean-Marc Lasgouttes + + * 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 Fix crash caused by dereferencing null pointer 'exportdata' in diff --git a/src/lyxrc.C b/src/lyxrc.C index f62f7a0ff0..b4818069f2 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -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"); } diff --git a/src/messages.C b/src/messages.C index 0fcf097708..d1aa3f5221 100644 --- a/src/messages.C +++ b/src/messages.C @@ -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); diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 77a561e446..727543fae6 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,11 @@ +2004-05-04 Jean-Marc Lasgouttes + + * 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 * Makefile.am (libsupport_la_SOURCES): remove reference to diff --git a/src/support/path_defines.C.in b/src/support/path_defines.C.in index ec81554802..f3a0c5eaf6 100644 --- a/src/support/path_defines.C.in +++ b/src/support/path_defines.C.in @@ -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: '"