* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
- * Copyright 1995-1999 The LyX Team.
+ * Copyright 1995-2000 The LyX Team.
*
* ====================================================== */
#include "support/lyxlib.h"
#include "support/lstrings.h"
#include "lyxrc.h"
+#include "language.h"
-extern LyXRC * lyxrc;
+using std::ostream;
+using std::endl;
BufferParams::BufferParams()
{
secnumdepth = 3;
tocdepth = 3;
language = "default";
+ language_info = default_language;
fonts = "default";
inputenc = "latin1";
graphicsDriver = "default";
if (!lex.next()) return;
string tmptok = lex.GetString();
- string test;
- int n = 0;
+
// check if tmptok is part of tex_babel in tex-defs.h
- while (true) {
- test = tex_babel[n++];
-
- if (test == tmptok) {
- language = tmptok;
- break;
- }
- else if (test.empty()) {
+ Languages::iterator lit = languages.find(tmptok);
+ if (lit != languages.end()) {
+ // found it
+ language = tmptok;
+ language_info = &(*lit).second;
+ } else {
+ // not found
+ language = "default";
+ language_info = default_language;
+ if (tmptok != "default") {
lyxerr << "Warning: language `"
<< tmptok << "' not recognized!\n"
<< " Setting language to `default'."
<< endl;
- language = "default";
- break;
- }
+ }
}
}
}
}
}
-
-
-LyXDirection BufferParams::getDocumentDirection() const
-{
- return (lyxrc->rtl_support && language == "hebrew")
- ? LYX_DIR_RIGHT_TO_LEFT : LYX_DIR_LEFT_TO_RIGHT;
-}