]> git.lyx.org Git - lyx.git/blobdiff - src/language.C
more changes, read the Changelog
[lyx.git] / src / language.C
index 8b210dd11918f79b08720c724a0af9f1e0fdd330..cee95f73db5a591aad3facd1688950b0b26de1b8 100644 (file)
@@ -6,7 +6,7 @@
 
 Languages languages;
 Language const * default_language;
-Language ignore_lang = {"ignore", "Ignore", false};
+Language ignore_lang("ignore", "Ignore", false);
 Language const * ignore_language = &ignore_lang;
 
 ///
@@ -19,11 +19,11 @@ public:
        }
 private:
        ///
-       void newLang(string const & l, string const & d, bool rtl) {
-               Language lang;
-               lang.lang = l;
-               lang.display = d;
-               lang.RightToLeft = rtl;
+       void newLang(char const * l, char const * d, bool rtl) {
+               Language lang(l, d, rtl);
+               //lang.lang = l;
+               //lang.display = d;
+               //lang.RightToLeft = rtl;
                languages[l] = lang;
        }
        ///
@@ -33,49 +33,73 @@ private:
 };
 
 
+struct lang_item {
+       char const * lang;
+       char const * display;
+       bool rtl;
+};
+
+
 void LangInit::initL()
 {
-       newLang("afrikaans", N_("Afrikaans"), false);
-       newLang("american", N_("American"), false);
-       newLang("arabic", N_("Arabic"), true);
-       newLang("austrian", N_("Austrian"), false);
-       newLang("bahasa", N_("Bahasa"), false);
-       newLang("brazil", N_("Brazil"), false);
-       newLang("breton", N_("Breton"), false);
-       newLang("catalan", N_("Catalan"), false);
-       newLang("croatian", N_("Croatian"), false);
-       newLang("czech", N_("Czech"), false);
-       newLang("danish", N_("Danish"), false);
-       newLang("dutch", N_("Dutch"), false);
-       newLang("english", N_("English"), false);
-       newLang("esperanto", N_("Esperanto"), false);
-       newLang("estonian", N_("Estonian"), false);
-       newLang("finnish", N_("Finnish"), false);
-       newLang("francais", N_("Francais"), false);
-       newLang("french", N_("French"), false);
-       newLang("frenchb", N_("Frenchb"), false);
-       newLang("galician", N_("Galician"), false);
-       newLang("german", N_("German"), false);
-       newLang("greek", N_("Greek"), false);
-       newLang("hebrew", N_("Hebrew"), true);
-       newLang("hungarian", N_("Hungarian"), false);
-       newLang("irish", N_("Irish"), false);
-       newLang("italian", N_("Italian"), false);
-       newLang("lsorbian", N_("Lsorbian"), false);
-       newLang("magyar", N_("Magyar"), false);
-       newLang("norsk", N_("Norsk"), false);
-       newLang("polish", N_("Polish"), false);
-       newLang("portuges", N_("Portuges"), false);
-       newLang("romanian", N_("Romanian"), false);
-       newLang("russian", N_("Russian"), false);
-       newLang("scottish", N_("Scottish"), false);
-       newLang("spanish", N_("Spanish"), false);
-       newLang("slovak", N_("Slovak"), false);
-       newLang("slovene", N_("Slovene"), false);
-       newLang("swedish", N_("Swedish"), false);
-       newLang("turkish", N_("Turkish"), false);
-       newLang("usorbian", N_("Usorbian"), false);
-       newLang("welsh", N_("Welsh"), false);
+       // Use this style of initialization to lower compilation times.
+       // Same method is used in LyXAction.C (Lgb)
+       
+       lang_item items[] = {
+       { "afrikaans", N_("Afrikaans"), false },
+       { "american", N_("American"), false },
+       { "arabic", N_("Arabic"), true },
+       { "austrian", N_("Austrian"), false },
+       { "bahasa", N_("Bahasa"), false },
+       { "brazil", N_("Brazil"), false },
+       { "breton", N_("Breton"), false },
+       { "catalan", N_("Catalan"), false },
+       { "croatian", N_("Croatian"), false },
+       { "czech", N_("Czech"), false },
+       { "danish", N_("Danish"), false },
+       { "dutch", N_("Dutch"), false },
+       { "english", N_("English"), false },
+       { "esperanto", N_("Esperanto"), false },
+       { "estonian", N_("Estonian"), false },
+       { "finnish", N_("Finnish"), false },
+       { "francais", N_("Francais"), false },
+       { "french", N_("French"), false },
+       { "frenchb", N_("Frenchb"), false },
+       { "galician", N_("Galician"), false },
+       { "german", N_("German"), false },
+       { "greek", N_("Greek"), false },
+       { "hebrew", N_("Hebrew"), true },
+       /* According to Zrubecz Laszlo <zrubi@k2.jozsef.kando.hu>,
+          "magyar" is better. I kept it here in case we want
+          to  provide aliasing of languages. (JMarc) 
+       */
+       //{ "hungarian", N_("Hungarian"), false },
+       { "irish", N_("Irish"), false },
+       { "italian", N_("Italian"), false },
+       { "lsorbian", N_("Lsorbian"), false },
+       { "magyar", N_("Magyar"), false },
+       { "norsk", N_("Norsk"), false },
+       { "polish", N_("Polish"), false },
+       { "portuges", N_("Portuges"), false },
+       { "romanian", N_("Romanian"), false },
+       { "russian", N_("Russian"), false },
+       { "scottish", N_("Scottish"), false },
+       { "spanish", N_("Spanish"), false },
+       { "slovak", N_("Slovak"), false },
+       { "slovene", N_("Slovene"), false },
+       { "swedish", N_("Swedish"), false },
+       { "turkish", N_("Turkish"), false },
+       { "usorbian", N_("Usorbian"), false },
+       { "welsh", N_("Welsh"), false },
+       { 0, 0, false }
+       };
+
+       int i = 0;
+       while (items[i].lang) {
+               newLang(items[i].lang, items[i].display, items[i].rtl);
+               ++i;
+       }
+       
        default_language = &languages["american"];
 }