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
This commit is contained in:
Abdelrazak Younes 2007-04-03 10:45:22 +00:00
parent f7665c1e11
commit f4f0707fb2
4 changed files with 3 additions and 29 deletions

View File

@ -594,11 +594,6 @@ bool Buffer::readString(std::string const & s)
break; 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; return true;
} }
@ -618,11 +613,6 @@ bool Buffer::readFile(FileName const & filename)
if (readFile(lex, filename) != success) if (readFile(lex, filename) != success)
return false; 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; return true;
} }
@ -1385,9 +1375,6 @@ void Buffer::changeLanguage(Language const * from, Language const * to)
BOOST_ASSERT(from); BOOST_ASSERT(from);
BOOST_ASSERT(to); BOOST_ASSERT(to);
// Take care of l10n/i18n
updateDocLang(to);
for_each(par_iterator_begin(), for_each(par_iterator_begin(),
par_iterator_end(), par_iterator_end(),
bind(&Paragraph::changeLanguage, _1, params(), from, to)); 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 bool Buffer::isMultiLingual() const
{ {
ParConstIterator end = par_iterator_end(); ParConstIterator end = par_iterator_end();
@ -1474,8 +1453,9 @@ Language const * Buffer::getLanguage() const
docstring const Buffer::B_(string const & l10n) const docstring const Buffer::B_(string const & l10n) const
{ {
if (pimpl_->messages) Language const * lang = pimpl_->params.language;
return pimpl_->messages->get(l10n); if (lang)
return getMessages(lang->code()).get(l10n);
return _(l10n); return _(l10n);
} }

View File

@ -298,9 +298,6 @@ public:
/// ///
void changeLanguage(Language const * from, Language const * to); void changeLanguage(Language const * from, Language const * to);
///
void updateDocLang(Language const * nlang);
/// ///
bool isMultiLingual() const; bool isMultiLingual() const;

View File

@ -214,7 +214,6 @@ Buffer * newFile(string const & filename, string const & templatename,
b->setReadonly(false); b->setReadonly(false);
b->fully_loaded(true); b->fully_loaded(true);
b->updateDocLang(b->params().language);
return b; return b;
} }

View File

@ -1582,8 +1582,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
if (oldL->rightToLeft() == newL->rightToLeft() if (oldL->rightToLeft() == newL->rightToLeft()
&& !buffer.isMultiLingual()) && !buffer.isMultiLingual())
buffer.changeLanguage(oldL, newL); buffer.changeLanguage(oldL, newL);
else
buffer.updateDocLang(newL);
break; break;
} }