+2003-04-23 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * messages.[Ch]: New files
+
2003-04-18 John Levon <levon@movementarian.org>
* BufferView.h:
* LyXAction.C:
* lyxtext.h:
* text2.C: remove layout-copy/paste (bug 778)
-
+
2003-04-16 Alfredo Braunstein <abraunst@libero.it>
-
- * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop
-
+
+ * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop
+
2003-04-16 Alfredo Braunstein <abraunst@libero.it>
* bufferlist.C (quitWriteBuffer): WriteAs and MenuWrite return true
--- /dev/null
+* \file messages.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#include "messages.h"
+#include "debug.h"
+
+using std::endl;
+
+
+Messages::Messages(string const & l, string const & dir)
+ : lang_(l), localedir_(dir),
+ loc_gl(lang_.c_str()),
+ mssg_gl(std::use_facet<std::messages<char> >(loc_gl))
+{
+ lyxerr << "Messages: language(" << l << ") in dir(" << dir << ")" << endl;
+
+ cat_gl = mssg_gl.open("lyx", loc_gl, localedir_.c_str());
+}
+
+
+Messages::~Messages()
+{
+ mssg_gl.close(cat_gl);
+}
+
+
+string const Messages::get(string const & msg) const
+{
+ return mssg_gl.get(cat_gl, 0, 0, msg);
+}
--- /dev/null
+// -*- C++ -*-
+* \file messages.h
+* This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef MESSAGES_H
+#define MESSAGES_H
+
+#include "LString.h"
+
+#include <locale>
+
+///
+class Messages {
+public:
+ ///
+ typedef std::messages<char>::catalog catalog;
+ ///
+ Messages(string const & l, string const & dir);
+ ///
+ ~Messages();
+ ///
+ string const get(string const & msg) const;
+ ///
+ string const & lang() const {
+ return lang_;
+ }
+ ///
+ string const & localedir() const {
+ return localedir_;
+ }
+private:
+ ///
+ string lang_;
+ ///
+ string localedir_;
+ ///
+ std::locale loc_gl;
+ ///
+ std::messages<char> const & mssg_gl;
+ ///
+ catalog cat_gl;
+};
+
+#endif