mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +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>
|
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.
|
* main.C: add myself and Jean Marc as authors.
|
||||||
|
|
||||||
2003-04-24 Lars Gullik Bjønnes <larsbj@gullik.net>
|
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 "lyxtextclasslist.h"
|
||||||
#include "sgml.h"
|
#include "sgml.h"
|
||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "author.h"
|
#include "author.h"
|
||||||
|
|
||||||
#include "frontends/LyXView.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)
|
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..
|
// 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()) {
|
if (!lex.isOK()) {
|
||||||
Alert::error(_("Document could not be read"),
|
Alert::error(_("Document could not be read"),
|
||||||
@ -1631,7 +1641,6 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
|||||||
#endif
|
#endif
|
||||||
Alert::error(_("Could not save document"), text);
|
Alert::error(_("Could not save document"), text);
|
||||||
return;
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
niceFile = nice; // this will be used by Insetincludes.
|
niceFile = nice; // this will be used by Insetincludes.
|
||||||
@ -2206,6 +2215,8 @@ void Buffer::redraw()
|
|||||||
|
|
||||||
void Buffer::changeLanguage(Language const * from, Language const * to)
|
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();
|
ParIterator end = par_iterator_end();
|
||||||
for (ParIterator it = par_iterator_begin(); it != end; ++it)
|
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
|
bool Buffer::isClean() const
|
||||||
{
|
{
|
||||||
return lyx_clean;
|
return lyx_clean;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "author.h"
|
#include "author.h"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
class BufferView;
|
class BufferView;
|
||||||
class LyXRC;
|
class LyXRC;
|
||||||
@ -33,6 +34,7 @@ class LaTeXFeatures;
|
|||||||
class Language;
|
class Language;
|
||||||
class ParIterator;
|
class ParIterator;
|
||||||
class ParConstIterator;
|
class ParConstIterator;
|
||||||
|
class Messages;
|
||||||
|
|
||||||
|
|
||||||
/** The buffer object.
|
/** The buffer object.
|
||||||
@ -169,6 +171,9 @@ public:
|
|||||||
|
|
||||||
/// returns the main language for the buffer (document)
|
/// returns the main language for the buffer (document)
|
||||||
Language const * getLanguage() const;
|
Language const * getLanguage() const;
|
||||||
|
/// get l10n translated to the buffers language
|
||||||
|
string const B_(string const & l10n) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
int runChktex();
|
int runChktex();
|
||||||
/// return true if the main lyx file does not need saving
|
/// 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#.
|
of the buffers in the list of users to do a #updateLayoutChoice#.
|
||||||
*/
|
*/
|
||||||
BufferView * users;
|
BufferView * users;
|
||||||
|
///
|
||||||
|
boost::scoped_ptr<Messages> messages_;
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
class inset_iterator {
|
class inset_iterator {
|
||||||
|
Loading…
Reference in New Issue
Block a user