On 29.03.2011 23:47, Jean-Marc Lasgouttes wrote:
Le 29/03/11 21:40, veno...@arcadiaclub.com a écrit :
Building LyX SVN with scons everything is OK, while using CMake, following the steps in
INSTALL.Win32, I receive an assertion about "Package" not being initialized.
Any idea about the reason?
Maybe it's this FIXME (LyX.cpp:289):
int LyX::exec(int& argc, char * argv[])
{
// Minimal setting of locale before parsing command line
try {
init_package(os::utf8_argv(0), string(), string(),
top_build_dir_is_one_level_up);
} catch (ExceptionMessage const& message) {
LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
}
// FIXME: This breaks out of source build under Windows.
locale_init();
What is strange is that Package is initialized in the init_package call
just above. If it does not work, I guess we have a an exception that we
cannot see because we send it to Debug::LOCALE, which is disabled at
this point.
What happens if thelocale_init() call is moved inside the try{} clause?
Also I would be interested to know what happens if
LYXERR(Debug::LOCALE,...
is replaced by
LYERR0(...
What about this?
Peter
Index: src/LyX.cpp
===================================================================
--- src/LyX.cpp (revision 38136)
+++ src/LyX.cpp (working copy)
@@ -295,8 +295,7 @@
} catch (ExceptionMessage const & message) {
LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
}
- // FIXME: This breaks out of source build under Windows.
- locale_init();
+ set_locale_only();
// Here we need to parse the command line. At least
// we need to parse for "-dbg" and "-help"
@@ -314,6 +313,7 @@
Alert::warning(message.title_, message.details_);
}
}
+ locale_init();
// Reinit the messages machinery in case package() knows
// something interesting about the locale directory.
Index: src/support/gettext.cpp
===================================================================
--- src/support/gettext.cpp (revision 38097)
+++ src/support/gettext.cpp (working copy)
@@ -30,19 +30,27 @@
}
-void locale_init()
+void set_locale_only()
{
#ifdef ENABLE_NLS
# ifdef HAVE_LC_MESSAGES
setlocale(LC_MESSAGES, "");
# endif
setlocale(LC_CTYPE, "");
- Messages::init();
#endif
setlocale(LC_NUMERIC, "C");
}
+void locale_init()
+{
+ set_locale_only();
+#ifdef ENABLE_NLS
+ Messages::init();
+#endif
+}
+
+
docstring const translateIfPossible(docstring const & name)
{
if (support::isAscii(name) && !name.empty())
Index: src/support/gettext.h
===================================================================
--- src/support/gettext.h (revision 38097)
+++ src/support/gettext.h (working copy)
@@ -77,7 +77,10 @@
///
void locale_init();
+///
+void set_locale_only();
+
} // namespace lyx
#endif