]> git.lyx.org Git - features.git/commitdiff
fix bug #8210
authorUwe Stöhr <uwestoehr@lyx.org>
Sun, 24 Jun 2012 16:24:28 +0000 (18:24 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Sun, 24 Jun 2012 16:24:28 +0000 (18:24 +0200)
we need to store the document language from the beginning of the document in the context to be able to handle all kinds of language switch commands

src/tex2lyx/Preamble.h
src/tex2lyx/tex2lyx.cpp

index ba4ef31c8eb3267dcde5fb5ebd4c94b0a60ca2a0..585cb25c73e0d1bcd1ca87dea1724194a5c05416 100644 (file)
@@ -34,6 +34,8 @@ class Preamble
 public:
        Preamble();
 
+       ///
+       std::string h_language;
        ///
        std::string inputencoding() const { return h_inputencoding; }
        ///
@@ -115,7 +117,6 @@ private:
        std::string h_index_command;
        std::string h_inputencoding;
        std::string h_justification;
-       std::string h_language;
        std::string h_language_package;
        std::string h_listings_params;
        std::string h_maintain_unincluded_children;
index c7bccc349b477438cc787d97beb2f890fd905b85..b713e4c76dab30d991afc37238db8dced7e4b467 100644 (file)
@@ -671,6 +671,10 @@ bool tex2lyx(idocstream & is, ostream & os, string encoding)
        active_environments.push_back("document");
        Context context(true, textclass);
        stringstream ss;
+       // store the document language in the context to be able to handle the
+       // commands like \foreignlanguage and \textenglish etc.
+       context.font.language = preamble.h_language;
+       // parse the main text
        parse_text(p, ss, FLAG_END, true, context);
        if (Context::empty)
                // Empty document body. LyX needs at least one paragraph.