]> git.lyx.org Git - lyx.git/blobdiff - src/Language.cpp
ru/Tutorial: re-save in 2.3 format
[lyx.git] / src / Language.cpp
index a1f356247b00616cb645068fca9ff6aebb5d5472..97a17880c16e40ced1f8cef5d4220107d77f9408 100644 (file)
 #include "support/filetools.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
+#include "support/qstring_helpers.h"
 #include "support/Messages.h"
 
+#include <QLocale>
+#include <QString>
+
 using namespace std;
 using namespace lyx::support;
 
@@ -111,6 +115,16 @@ string Language::dateFormat(size_t i) const
 }
 
 
+docstring Language::decimalSeparator() const
+{
+       if (lyxrc.default_decimal_sep == "locale") {
+               QLocale loc = QLocale(toqstr(code()));
+               return qstring_to_ucs4(QString(loc.decimalPoint()));
+       }
+       return from_utf8(lyxrc.default_decimal_sep);
+}
+
+
 bool Language::readLanguage(Lexer & lex)
 {
        enum LanguageTags {
@@ -132,11 +146,13 @@ bool Language::readLanguage(Lexer & lex)
                LA_REQUIRES,
                LA_QUOTESTYLE,
                LA_RTL,
-               LA_WORDWRAP
+               LA_WORDWRAP,
+               LA_ACTIVECHARS
        };
 
        // Keep these sorted alphabetically!
        LexerKeyword languageTags[] = {
+               { "activechars",          LA_ACTIVECHARS },
                { "babelname",            LA_BABELNAME },
                { "dateformats",          LA_DATEFORMATS },
                { "encoding",             LA_ENCODING },
@@ -193,6 +209,9 @@ bool Language::readLanguage(Lexer & lex)
                case LA_QUOTESTYLE:
                        lex >> quote_style_;
                        break;
+               case LA_ACTIVECHARS:
+                       lex >> active_chars_;
+                       break;
                case LA_ENCODING:
                        lex >> encodingStr_;
                        break;
@@ -390,7 +409,7 @@ Match match(string const & code, Language const & lang)
        if ((code.size() == 2) && (langcode.size() > 2)
                && (code + '_' == langcode.substr(0, 3)))
                return ApproximateMatch;
-       if (code.substr(0,2) == langcode.substr(0,2))
+       if (code.substr(0,2) == langcode.substr(0,2))
                return VeryApproximateMatch;
        return NoMatch;
 }