From f4f0707fb2dc9a69fdd7dbb0af4d84511e5a6db1 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 3 Apr 2007 10:45:22 +0000 Subject: [PATCH] Small cleanup. updateDocLang() was basically a void function since my paragraph language cleanup. * Buffer: - updateDocLang(): deleted. - B_(): use getLanguage() directly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17706 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/buffer.C | 26 +++----------------------- src/buffer.h | 3 --- src/buffer_funcs.C | 1 - src/lyxfunc.C | 2 -- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/buffer.C b/src/buffer.C index 5f579021fb..84cf5e9882 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -594,11 +594,6 @@ bool Buffer::readString(std::string const & s) break; } - // 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) - updateDocLang(params().language); - return true; } @@ -618,11 +613,6 @@ bool Buffer::readFile(FileName const & filename) if (readFile(lex, filename) != success) return false; - // 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) - updateDocLang(params().language); - return true; } @@ -1385,9 +1375,6 @@ void Buffer::changeLanguage(Language const * from, Language const * to) BOOST_ASSERT(from); BOOST_ASSERT(to); - // Take care of l10n/i18n - updateDocLang(to); - for_each(par_iterator_begin(), par_iterator_end(), bind(&Paragraph::changeLanguage, _1, params(), from, to)); @@ -1397,14 +1384,6 @@ void Buffer::changeLanguage(Language const * from, Language const * to) } -void Buffer::updateDocLang(Language const * nlang) -{ - BOOST_ASSERT(nlang); - - pimpl_->messages = &getMessages(nlang->code()); -} - - bool Buffer::isMultiLingual() const { ParConstIterator end = par_iterator_end(); @@ -1474,8 +1453,9 @@ Language const * Buffer::getLanguage() const docstring const Buffer::B_(string const & l10n) const { - if (pimpl_->messages) - return pimpl_->messages->get(l10n); + Language const * lang = pimpl_->params.language; + if (lang) + return getMessages(lang->code()).get(l10n); return _(l10n); } diff --git a/src/buffer.h b/src/buffer.h index 61005fe9b0..94694e2622 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -298,9 +298,6 @@ public: /// void changeLanguage(Language const * from, Language const * to); - /// - void updateDocLang(Language const * nlang); - /// bool isMultiLingual() const; diff --git a/src/buffer_funcs.C b/src/buffer_funcs.C index 77c1af818d..35e977fc2e 100644 --- a/src/buffer_funcs.C +++ b/src/buffer_funcs.C @@ -214,7 +214,6 @@ Buffer * newFile(string const & filename, string const & templatename, b->setReadonly(false); b->fully_loaded(true); - b->updateDocLang(b->params().language); return b; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 33d3ef2cb4..ddbf6d5343 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1582,8 +1582,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd) if (oldL->rightToLeft() == newL->rightToLeft() && !buffer.isMultiLingual()) buffer.changeLanguage(oldL, newL); - else - buffer.updateDocLang(newL); break; } -- 2.39.2