From 4fbd6bcd95521b065d991bd6843a541c06eb67ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 23 Apr 2003 18:47:21 +0000 Subject: [PATCH] messge files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6840 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 12 ++++++++---- src/messages.C | 38 ++++++++++++++++++++++++++++++++++++++ src/messages.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/messages.C create mode 100644 src/messages.h diff --git a/src/ChangeLog b/src/ChangeLog index 4b2e753b1a..07ebb157ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-04-23 Lars Gullik Bjønnes + + * messages.[Ch]: New files + 2003-04-18 John Levon * BufferView.h: @@ -7,11 +11,11 @@ * LyXAction.C: * lyxtext.h: * text2.C: remove layout-copy/paste (bug 778) - + 2003-04-16 Alfredo Braunstein - - * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop - + + * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop + 2003-04-16 Alfredo Braunstein * bufferlist.C (quitWriteBuffer): WriteAs and MenuWrite return true diff --git a/src/messages.C b/src/messages.C new file mode 100644 index 0000000000..a3748451d4 --- /dev/null +++ b/src/messages.C @@ -0,0 +1,38 @@ +* \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 + +#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 >(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); +} diff --git a/src/messages.h b/src/messages.h new file mode 100644 index 0000000000..b426ccf0c3 --- /dev/null +++ b/src/messages.h @@ -0,0 +1,50 @@ +// -*- 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 + +/// +class Messages { +public: + /// + typedef std::messages::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 const & mssg_gl; + /// + catalog cat_gl; +}; + +#endif -- 2.39.5