mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
more message work, should now be ready for real integration
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6850 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a93df297d9
commit
86bc0ad030
@ -1,5 +1,10 @@
|
||||
2003-04-25 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* buffer.C (readFile): set message_ after file is loaded.
|
||||
(makeDocBookFile): remove double return
|
||||
(changeLanguage): reset message_ upon language change.
|
||||
(B_): new func, use this to get translated buffer strings.
|
||||
|
||||
* main.C: add myself and Jean Marc as authors.
|
||||
|
||||
2003-04-24 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
27
src/buffer.C
27
src/buffer.C
@ -36,6 +36,7 @@
|
||||
#include "lyxtextclasslist.h"
|
||||
#include "sgml.h"
|
||||
#include "paragraph_funcs.h"
|
||||
#include "messages.h"
|
||||
#include "author.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
@ -494,12 +495,21 @@ void Buffer::insertStringAsLines(ParagraphList::iterator & par, pos_type & pos,
|
||||
|
||||
bool Buffer::readFile(LyXLex & lex, string const & filename)
|
||||
{
|
||||
return readFile(lex, filename, paragraphs.begin());
|
||||
bool ret = readFile(lex, filename, paragraphs.begin());
|
||||
|
||||
// After we have read a file, we must ensure that the buffer
|
||||
// language is set and used in the gui.
|
||||
// If you know of a better place to put this, please tell me. (Lgb)
|
||||
messages_.reset(new Messages(params.language->code(),
|
||||
"/usr/local/share/locale"));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// FIXME: all the below Alerts should give the filename..
|
||||
bool Buffer::readFile(LyXLex & lex, string const & filename, ParagraphList::iterator pit)
|
||||
bool Buffer::readFile(LyXLex & lex, string const & filename,
|
||||
ParagraphList::iterator pit)
|
||||
{
|
||||
if (!lex.isOK()) {
|
||||
Alert::error(_("Document could not be read"),
|
||||
@ -1631,7 +1641,6 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
#endif
|
||||
Alert::error(_("Could not save document"), text);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
niceFile = nice; // this will be used by Insetincludes.
|
||||
@ -2206,6 +2215,8 @@ void Buffer::redraw()
|
||||
|
||||
void Buffer::changeLanguage(Language const * from, Language const * to)
|
||||
{
|
||||
// Take care of l10n/i18n
|
||||
messages_.reset(new Messages(to->code(), "/usr/local/share/locale"));
|
||||
|
||||
ParIterator end = par_iterator_end();
|
||||
for (ParIterator it = par_iterator_begin(); it != end; ++it)
|
||||
@ -2315,6 +2326,16 @@ Language const * Buffer::getLanguage() const
|
||||
}
|
||||
|
||||
|
||||
string const Buffer::B_(string const & l10n) const
|
||||
{
|
||||
if (messages_.get()) {
|
||||
return messages_->get(l10n);
|
||||
}
|
||||
|
||||
return _(l10n);
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::isClean() const
|
||||
{
|
||||
return lyx_clean;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "author.h"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
class BufferView;
|
||||
class LyXRC;
|
||||
@ -33,6 +34,7 @@ class LaTeXFeatures;
|
||||
class Language;
|
||||
class ParIterator;
|
||||
class ParConstIterator;
|
||||
class Messages;
|
||||
|
||||
|
||||
/** The buffer object.
|
||||
@ -169,6 +171,9 @@ public:
|
||||
|
||||
/// returns the main language for the buffer (document)
|
||||
Language const * getLanguage() const;
|
||||
/// get l10n translated to the buffers language
|
||||
string const B_(string const & l10n) const;
|
||||
|
||||
///
|
||||
int runChktex();
|
||||
/// return true if the main lyx file does not need saving
|
||||
@ -326,6 +331,8 @@ private:
|
||||
of the buffers in the list of users to do a #updateLayoutChoice#.
|
||||
*/
|
||||
BufferView * users;
|
||||
///
|
||||
boost::scoped_ptr<Messages> messages_;
|
||||
public:
|
||||
///
|
||||
class inset_iterator {
|
||||
|
Loading…
Reference in New Issue
Block a user