messge files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6840 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-04-23 18:47:21 +00:00
parent 51de4d6b81
commit 4fbd6bcd95
3 changed files with 96 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2003-04-23 Lars Gullik Bjønnes <larsbj@gullik.net>
* messages.[Ch]: New files
2003-04-18 John Levon <levon@movementarian.org>
* BufferView.h:
@ -7,11 +11,11 @@
* 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

38
src/messages.C Normal file
View File

@ -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 <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);
}

50
src/messages.h Normal file
View File

@ -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 <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