2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
2000-03-10 13:52:19 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
#include "language.h"
|
|
|
|
#include "gettext.h"
|
2000-07-04 20:32:37 +00:00
|
|
|
#include "encoding.h"
|
2000-03-10 13:52:19 +00:00
|
|
|
|
|
|
|
Languages languages;
|
2000-05-19 19:46:23 +00:00
|
|
|
Language const * default_language;
|
2000-07-04 20:32:37 +00:00
|
|
|
Language ignore_lang("ignore", "Ignore", false, 0);
|
2000-03-17 10:14:46 +00:00
|
|
|
Language const * ignore_language = &ignore_lang;
|
2000-03-10 13:52:19 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
///
|
2000-03-10 13:52:19 +00:00
|
|
|
class LangInit {
|
|
|
|
public:
|
2000-04-04 00:19:15 +00:00
|
|
|
///
|
2000-03-10 13:52:19 +00:00
|
|
|
LangInit() {
|
|
|
|
if (!init) initL();
|
|
|
|
init = true;
|
|
|
|
}
|
|
|
|
private:
|
2000-04-04 00:19:15 +00:00
|
|
|
///
|
|
|
|
void initL();
|
|
|
|
///
|
2000-03-10 13:52:19 +00:00
|
|
|
static bool init;
|
|
|
|
};
|
2000-04-04 00:19:15 +00:00
|
|
|
|
|
|
|
|
2000-05-21 18:40:10 +00:00
|
|
|
struct lang_item {
|
|
|
|
char const * lang;
|
|
|
|
char const * display;
|
|
|
|
bool rtl;
|
2000-07-04 20:32:37 +00:00
|
|
|
Encoding const * encoding;
|
2000-05-21 18:40:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
void LangInit::initL()
|
|
|
|
{
|
2000-05-21 18:40:10 +00:00
|
|
|
// Use this style of initialization to lower compilation times.
|
|
|
|
// Same method is used in LyXAction.C (Lgb)
|
2000-07-04 20:32:37 +00:00
|
|
|
|
2000-05-21 18:40:10 +00:00
|
|
|
lang_item items[] = {
|
2000-07-04 20:32:37 +00:00
|
|
|
{ "afrikaans", N_("Afrikaans"), false, &iso8859_1 },
|
|
|
|
{ "american", N_("American"), false, &iso8859_1 },
|
|
|
|
{ "arabic", N_("Arabic"), true, &iso8859_6 },
|
|
|
|
{ "austrian", N_("Austrian"), false, &iso8859_1 },
|
|
|
|
{ "bahasa", N_("Bahasa"), false, &iso8859_1 },
|
|
|
|
{ "brazil", N_("Brazil"), false, &iso8859_1 },
|
|
|
|
{ "breton", N_("Breton"), false, &iso8859_1 },
|
|
|
|
{ "catalan", N_("Catalan"), false, &iso8859_1 },
|
|
|
|
{ "croatian", N_("Croatian"), false, &iso8859_2 },
|
|
|
|
{ "czech", N_("Czech"), false, &iso8859_2 },
|
|
|
|
{ "danish", N_("Danish"), false, &iso8859_1 },
|
2000-09-08 11:15:01 +00:00
|
|
|
{ "default", N_("Document wide language"), false, &iso8859_1 },
|
2000-07-04 20:32:37 +00:00
|
|
|
{ "dutch", N_("Dutch"), false, &iso8859_1 },
|
|
|
|
{ "english", N_("English"), false, &iso8859_1 },
|
2000-07-20 10:04:27 +00:00
|
|
|
{ "esperanto", N_("Esperanto"), false, &iso8859_3 },
|
2000-07-04 20:32:37 +00:00
|
|
|
{ "estonian", N_("Estonian"), false, &iso8859_4 },
|
|
|
|
{ "finnish", N_("Finnish"), false, &iso8859_1 },
|
|
|
|
{ "francais", N_("Francais"), false, &iso8859_1 },
|
|
|
|
{ "french", N_("French"), false, &iso8859_1 },
|
|
|
|
{ "frenchb", N_("Frenchb"), false, &iso8859_1 },
|
|
|
|
{ "galician", N_("Galician"), false, &iso8859_1 },
|
|
|
|
{ "german", N_("German"), false, &iso8859_1 },
|
|
|
|
{ "greek", N_("Greek"), false, &iso8859_7 },
|
|
|
|
{ "hebrew", N_("Hebrew"), true, &cp1255 },
|
2000-05-22 13:20:51 +00:00
|
|
|
/* 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)
|
|
|
|
*/
|
2000-07-04 20:32:37 +00:00
|
|
|
//{ "hungarian", N_("Hungarian"), false, &iso8859_2 },
|
|
|
|
{ "irish", N_("Irish"), false, &iso8859_1 },
|
|
|
|
{ "italian", N_("Italian"), false, &iso8859_1 },
|
2000-07-20 10:04:27 +00:00
|
|
|
{ "lsorbian", N_("Lsorbian"), false, &iso8859_2 },
|
|
|
|
{ "magyar", N_("Magyar"), false, &iso8859_2 },
|
2000-07-04 20:32:37 +00:00
|
|
|
{ "norsk", N_("Norsk"), false, &iso8859_1 },
|
|
|
|
{ "polish", N_("Polish"), false, &iso8859_2 },
|
|
|
|
{ "portuges", N_("Portuges"), false, &iso8859_1 },
|
|
|
|
{ "romanian", N_("Romanian"), false, &iso8859_2 },
|
|
|
|
{ "russian", N_("Russian"), false, &koi8 },
|
|
|
|
{ "scottish", N_("Scottish"), false, &iso8859_1 },
|
|
|
|
{ "spanish", N_("Spanish"), false, &iso8859_1 },
|
|
|
|
{ "slovak", N_("Slovak"), false, &iso8859_2 },
|
|
|
|
{ "slovene", N_("Slovene"), false, &iso8859_2 },
|
|
|
|
{ "swedish", N_("Swedish"), false, &iso8859_1 },
|
2000-07-20 10:04:27 +00:00
|
|
|
{ "turkish", N_("Turkish"), false, &iso8859_9 },
|
|
|
|
{ "usorbian", N_("Usorbian"), false, &iso8859_2 },
|
2000-07-04 20:32:37 +00:00
|
|
|
{ "welsh", N_("Welsh"), false, &iso8859_1 },
|
|
|
|
{ 0, 0, false, 0 }
|
2000-05-21 18:40:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
while (items[i].lang) {
|
2000-07-04 20:32:37 +00:00
|
|
|
languages[items[i].lang] =
|
|
|
|
Language(items[i].lang, items[i].display,
|
|
|
|
items[i].rtl, items[i].encoding);
|
2000-05-21 18:40:10 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2000-09-08 11:15:01 +00:00
|
|
|
default_language = &languages["default"];
|
2000-04-04 00:19:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-10 13:52:19 +00:00
|
|
|
static
|
|
|
|
LangInit langinit;
|
|
|
|
|
|
|
|
bool LangInit::init = false;
|