]> git.lyx.org Git - lyx.git/commitdiff
- Coding style
authorAbdelrazak Younes <younes@lyx.org>
Thu, 14 Jul 2011 08:47:56 +0000 (08:47 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 14 Jul 2011 08:47:56 +0000 (08:47 +0000)
- Move local functions closer to where they are used.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39296 a592a061-630c-0410-9148-cb99ea01b6c8

src/Language.cpp

index 8f984325d8448e4c252e2a0efde5f0e8f90ba79b..8e5f86fa83afa4250c3a71528445be109a991818 100644 (file)
@@ -28,7 +28,6 @@
 using namespace std;
 using namespace lyx::support;
 
-
 namespace lyx {
 
 Languages languages;
@@ -194,57 +193,14 @@ bool Language::read(Lexer & lex)
 }
 
 
-namespace {
-
-bool readTranslations(Lexer & lex, Language::TranslationMap & trans)
-{
-       while (lex.isOK()) {
-               if (lex.checkFor("End"))
-                       break;
-               if (!lex.next(true))
-                       return false;
-               string const key = lex.getString();
-               if (!lex.next(true))
-                       return false;
-               docstring const val = lex.getDocString();
-               trans[key] = val;
-       }
-       return true;
-}
-
-enum Match{NoMatch, ApproximateMatch, ExactMatch};
-
-Match match(string const & code, Language const & lang)
-{
-       // we need to mimic gettext: code can be a two-letter code, which
-       // should match all variants, e.g. "de" should match "de_DE",
-       // "de_AT" etc.
-       // special case for chinese:
-       // simplified  => code == "zh_CN", langcode == "zh_CN"
-       // traditional => code == "zh_TW", langcode == "zh_CN"
-       string const variety = lang.variety();
-       string const langcode = variety.empty() ?
-                               lang.code() : lang.code() + '_' + variety;
-       string const name = lang.lang();
-       if ((code == langcode && name != "chinese-traditional") ||
-           (code == "zh_TW"  && name == "chinese-traditional"))
-               return ExactMatch;
-       if ((code.size() == 2 && langcode.size() > 2 &&
-            code + '_' == langcode.substr(0, 3)))
-               return ApproximateMatch;
-       return NoMatch;
-}
-
-}
-
-
 void Language::readLayoutTranslations(Language::TranslationMap const & trans, bool replace)
 {
        TranslationMap::const_iterator const end = trans.end();
-       for (TranslationMap::const_iterator it = trans.begin(); it != end; ++it)
-               if (replace ||
-                   layoutTranslations_.find(it->first) == layoutTranslations_.end())
+       for (TranslationMap::const_iterator it = trans.begin(); it != end; ++it) {
+               if (replace
+                       || layoutTranslations_.find(it->first) == layoutTranslations_.end())
                        layoutTranslations_[it->first] = it->second;
+       }
 }
 
 
@@ -294,6 +250,56 @@ void Languages::read(FileName const & filename)
 }
 
 
+namespace {
+
+bool readTranslations(Lexer & lex, Language::TranslationMap & trans)
+{
+       while (lex.isOK()) {
+               if (lex.checkFor("End"))
+                       break;
+               if (!lex.next(true))
+                       return false;
+               string const key = lex.getString();
+               if (!lex.next(true))
+                       return false;
+               docstring const val = lex.getDocString();
+               trans[key] = val;
+       }
+       return true;
+}
+
+
+enum Match {
+       NoMatch,
+       ApproximateMatch,
+       ExactMatch
+};
+
+
+Match match(string const & code, Language const & lang)
+{
+       // we need to mimic gettext: code can be a two-letter code, which
+       // should match all variants, e.g. "de" should match "de_DE",
+       // "de_AT" etc.
+       // special case for chinese:
+       // simplified  => code == "zh_CN", langcode == "zh_CN"
+       // traditional => code == "zh_TW", langcode == "zh_CN"
+       string const variety = lang.variety();
+       string const langcode = variety.empty() ?
+                               lang.code() : lang.code() + '_' + variety;
+       string const name = lang.lang();
+       if ((code == langcode && name != "chinese-traditional")
+               || (code == "zh_TW"  && name == "chinese-traditional"))
+               return ExactMatch;
+       if ((code.size() == 2) && (langcode.size() > 2)
+               && (code + '_' == langcode.substr(0, 3)))
+               return ApproximateMatch;
+       return NoMatch;
+}
+
+}
+
+
 void Languages::readLayoutTranslations(support::FileName const & filename)
 {
        Lexer lex;