* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
using namespace std;
-namespace {
+namespace lyx {
+
+// Instanciate static member.
+string Messages::main_lang_;
-using lyx::docstring;
-using lyx::from_ascii;
+namespace {
void cleanTranslation(docstring & trans)
{
}
}
-}
+} // anonymous
+} // lyx
#ifdef ENABLE_NLS
void Messages::setDefaultLanguage()
{
- char * env_lang[5] = {"LANGUAGE", "LC_ALL", "LC_MESSAGES", "LC_MESSAGE",
- "LANG"};
+ char const * env_lang[5] = {"LANGUAGE", "LC_ALL", "LC_MESSAGES",
+ "LC_MESSAGE", "LANG"};
for (size_t i = 0; i != 5; ++i) {
string const lang = getEnv(env_lang[i]);
if (lang.empty())
}
-// Instanciate static member.
-string Messages::main_lang_;
-
-
// This version use the traditional gettext.
Messages::Messages(string const & l)
: lang_(l), warned_(false)
// The string was not found, use gettext to generate it
static string oldLC_ALL;
+ static string oldLANGUAGE;
if (!lang_.empty()) {
oldLC_ALL = getEnv("LC_ALL");
// This GNU extension overrides any language locale
// wrt gettext.
LYXERR(Debug::LOCALE, "Setting LANGUAGE to " << lang_);
+ oldLANGUAGE = getEnv("LANGUAGE");
if (!setEnv("LANGUAGE", lang_))
LYXERR(Debug::LOCALE, "\t... failed!");
// However, setting LANGUAGE does nothing when the
// Reset environment variables as they were.
if (!lang_.empty()) {
// Reset everything as it was.
- LYXERR(Debug::LOCALE, "restoring LANGUAGE from " << getEnv("LANGUAGE")
- << " to " << main_lang_);
- if (!setEnv("LANGUAGE", main_lang_))
+ LYXERR(Debug::LOCALE, "restoring LANGUAGE from "
+ << getEnv("LANGUAGE")
+ << " to " << oldLANGUAGE);
+ if (!setEnv("LANGUAGE", oldLANGUAGE))
LYXERR(Debug::LOCALE, "\t... failed!");
LYXERR(Debug::LOCALE, "restoring LC_ALL from " << getEnv("LC_ALL")
<< " to " << oldLC_ALL);