]> git.lyx.org Git - features.git/commitdiff
Small cleanup. updateDocLang() was basically a void function since my paragraph langu...
authorAbdelrazak Younes <younes@lyx.org>
Tue, 3 Apr 2007 10:45:22 +0000 (10:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 3 Apr 2007 10:45:22 +0000 (10:45 +0000)
* 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
src/buffer.h
src/buffer_funcs.C
src/lyxfunc.C

index 5f579021fb14157cb2a5ff9d63916aa1f7318906..84cf5e988277f83ca408c2065ed3a7fb00ce0244 100644 (file)
@@ -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);
 }
index 61005fe9b0f5b7dac6ac041c561e45bb2f6d823c..94694e2622d847ceb5313721fbe229c900a6bbd1 100644 (file)
@@ -298,9 +298,6 @@ public:
        ///
        void changeLanguage(Language const * from, Language const * to);
 
-       ///
-       void updateDocLang(Language const * nlang);
-
        ///
        bool isMultiLingual() const;
 
index 77c1af818d97c8b0de92b6519d9c94bb89c6c5bb..35e977fc2e47bd100a02b5ff059c3d659d6a40f2 100644 (file)
@@ -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;
 }
index 33d3ef2cb45d228a258ea510c5424be469629b0b..ddbf6d53430d2479587f6d85485b8f8f4e7644b0 100644 (file)
@@ -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;
                }