language.cpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * 
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  * Documents produced by Doxygen are derivative works derived from the
00014  * input used in their production; they are not affected by this license.
00015  *
00016  */
00017 
00018 #include "message.h"
00019 #include "language.h"
00020 #include "lang_cfg.h"
00021 #include "translator.h"
00022 #include "translatordecoder.h"
00023 #include "translator_en.h"
00024 #if !defined(ENGLISH_ONLY)
00025 #include "translator_adapter.h"
00026 #ifdef LANG_NL
00027 #include "translator_nl.h"
00028 #endif
00029 #ifdef LANG_SE
00030 #include "translator_se.h"
00031 #endif
00032 #ifdef LANG_CZ
00033 #include "translator_cz.h"
00034 #endif
00035 #ifdef LANG_FR
00036 #include "translator_fr.h"
00037 #endif
00038 #ifdef LANG_ID
00039 #include "translator_id.h"
00040 #endif
00041 #ifdef LANG_IT
00042 #include "translator_it.h"
00043 #endif
00044 #ifdef LANG_DE
00045 #include "translator_de.h"
00046 #endif
00047 #ifdef LANG_JP
00048 #include "translator_jp.h"
00049 #endif
00050 #ifdef LANG_JE
00051 #include "translator_je.h"
00052 #endif
00053 #ifdef LANG_ES
00054 #include "translator_es.h"
00055 #endif
00056 #ifdef LANG_FI
00057 //#include "translator_fi.h"
00058 #endif
00059 #ifdef LANG_RU
00060 #include "translator_ru.h"
00061 #endif
00062 #ifdef LANG_HR
00063 #include "translator_hr.h"
00064 #endif
00065 #ifdef LANG_PL
00066 #include "translator_pl.h"
00067 #endif
00068 #ifdef LANG_PT
00069 #include "translator_pt.h"
00070 #endif
00071 #ifdef LANG_HU
00072 #include "translator_hu.h"
00073 #endif
00074 #ifdef LANG_KE
00075 #include "translator_ke.h"
00076 #endif
00077 #ifdef LANG_KR
00078 #include "translator_kr.h"
00079 #endif
00080 #ifdef LANG_RO
00081 #include "translator_ro.h"
00082 #endif
00083 #ifdef LANG_SI
00084 #include "translator_si.h"
00085 #endif
00086 #ifdef LANG_CN
00087 #include "translator_cn.h"
00088 #endif
00089 #ifdef LANG_TW
00090 #include "translator_tw.h"
00091 #endif
00092 #ifdef LANG_NO
00093 #include "translator_no.h"
00094 #endif
00095 #ifdef LANG_BR
00096 #include "translator_br.h"
00097 #endif
00098 #ifdef LANG_DK
00099 #include "translator_dk.h"
00100 #endif
00101 #ifdef LANG_SK
00102 #include "translator_sk.h"
00103 #endif
00104 #ifdef LANG_UA
00105 #include "translator_ua.h"
00106 #endif
00107 #ifdef LANG_GR
00108 #include "translator_gr.h"
00109 #endif
00110 #ifdef LANG_SR
00111 #include "translator_sr.h"
00112 #endif
00113 #ifdef LANG_CA
00114 #include "translator_ca.h"
00115 #endif
00116 //#ifdef LANG_JS
00117 //#include "translator_js.h"
00118 //#endif
00119 #ifdef LANG_LT
00120 #include "translator_lt.h"
00121 #endif
00122 #ifdef LANG_ZA
00123 #include "translator_za.h"
00124 #endif
00125 #ifdef LANG_AR
00126 #include "translator_ar.h"
00127 #endif
00128 #ifdef LANG_FA
00129 #include "translator_fa.h"
00130 #endif
00131 #ifdef LANG_MK
00132 #include "translator_mk.h"
00133 #endif
00134 #endif // !ENGLISH_ONLY
00135 
00136 #define L_EQUAL(a) !stricmp(langName,a)
00137 
00138 Translator *theTranslator=0;
00139 
00140 static const char obsoleteMsg[] =
00141         "---------\n"
00142         "ERROR: The selected language is no longer supported!\n"
00143         "If you want doxygen to produce output in this language \n"
00144         "you are kindly requested to help bringing the documentation \n"
00145         "up to date. Please read the development section of the manual \n"
00146         "for more information or contact Petr Prikryl (Prikryl@skil.cz).\n"
00147         "Thanks in advance!\n"
00148         "---------\n";
00149 
00150 bool setTranslator(const char *langName)
00151 {
00152   if (L_EQUAL("english"))
00153   {
00154     theTranslator=new TranslatorEnglish;
00155   }
00156 #if !defined(ENGLISH_ONLY)
00157 #ifdef LANG_NL
00158   else if (L_EQUAL("dutch"))
00159   {
00160     theTranslator=new TranslatorDutch;
00161   }
00162 #endif
00163 #ifdef LANG_SE
00164   else if (L_EQUAL("swedish"))
00165   {
00166     theTranslator=new TranslatorDecoder(new TranslatorSwedish);
00167   }
00168 #endif
00169 #ifdef LANG_CZ
00170   else if (L_EQUAL("czech"))
00171   {
00172     theTranslator=new TranslatorCzech;
00173   }
00174 #endif
00175 #ifdef LANG_FR  
00176   else if (L_EQUAL("french"))
00177   {
00178     theTranslator=new TranslatorDecoder(new TranslatorFrench);
00179   }
00180 #endif
00181 #ifdef LANG_ID  
00182   else if (L_EQUAL("indonesian"))
00183   {
00184     theTranslator=new TranslatorDecoder(new TranslatorIndonesian);
00185   }
00186 #endif
00187 #ifdef LANG_IT  
00188   else if (L_EQUAL("italian"))
00189   {
00190     theTranslator=new TranslatorItalian;
00191   }
00192 #endif
00193 #ifdef LANG_DE
00194   else if (L_EQUAL("german"))
00195   {
00196     theTranslator=new TranslatorDecoder(new TranslatorGerman);
00197   }
00198 #endif
00199 #ifdef LANG_JP
00200   else if (L_EQUAL("japanese"))
00201   {
00202     theTranslator=new TranslatorDecoder(new TranslatorJapanese);
00203   }
00204 #endif
00205 #ifdef LANG_JE
00206   else if (L_EQUAL("japanese-en"))
00207   {
00208     theTranslator=new TranslatorDecoder(new TranslatorJapaneseEn);
00209   }
00210 #endif
00211 #ifdef LANG_ES
00212   else if (L_EQUAL("spanish"))
00213   {
00214     theTranslator=new TranslatorDecoder(new TranslatorSpanish);
00215   }
00216 #endif
00217 #ifdef LANG_FI
00218   else if (L_EQUAL("finnish"))
00219   {
00220     //theTranslator=new TranslatorFinnish;
00221     theTranslator=new TranslatorEnglish;
00222     err(obsoleteMsg);
00223   }
00224 #endif
00225 #ifdef LANG_RU
00226   else if (L_EQUAL("russian"))
00227   {
00228     theTranslator=new TranslatorDecoder(new TranslatorRussian);
00229   }
00230 #endif
00231 #ifdef LANG_HR
00232   else if (L_EQUAL("croatian"))
00233   {
00234     theTranslator=new TranslatorDecoder(new TranslatorCroatian);
00235   }
00236 #endif
00237 #ifdef LANG_PL
00238   else if (L_EQUAL("polish"))
00239   {
00240     theTranslator=new TranslatorDecoder(new TranslatorPolish);
00241   }
00242 #endif
00243 #ifdef LANG_PT
00244   else if (L_EQUAL("portuguese"))
00245   {
00246     theTranslator=new TranslatorDecoder(new TranslatorPortuguese);
00247   }
00248 #endif
00249 #ifdef LANG_HU
00250   else if (L_EQUAL("hungarian"))
00251   {
00252     theTranslator=new TranslatorDecoder(new TranslatorHungarian);
00253   }
00254 #endif
00255 #ifdef LANG_KR
00256   else if (L_EQUAL("korean"))
00257   {
00258     theTranslator=new TranslatorDecoder(new TranslatorKorean);
00259   }
00260 #endif
00261 #ifdef LANG_KE
00262   else if (L_EQUAL("korean-en"))
00263   {
00264     theTranslator=new TranslatorDecoder(new TranslatorKoreanEn);
00265   }
00266 #endif
00267 #ifdef LANG_RO
00268   else if (L_EQUAL("romanian"))
00269   {
00270     theTranslator=new TranslatorDecoder(new TranslatorRomanian);
00271   }
00272 #endif
00273 #ifdef LANG_SI
00274   else if (L_EQUAL("slovene"))
00275   {
00276     theTranslator=new TranslatorDecoder(new TranslatorSlovene);
00277   }
00278 #endif
00279 #ifdef LANG_CN
00280   else if (L_EQUAL("chinese"))
00281   {
00282     theTranslator=new TranslatorDecoder(new TranslatorChinese);
00283   }
00284 #endif
00285 #ifdef LANG_TW
00286   else if (L_EQUAL("chinese-traditional"))
00287   {
00288     theTranslator=new TranslatorDecoder(new TranslatorChinesetraditional);
00289   }
00290 #endif
00291 #ifdef LANG_NO
00292   else if (L_EQUAL("norwegian"))
00293   {
00294     theTranslator=new TranslatorDecoder(new TranslatorNorwegian);
00295   }
00296 #endif
00297 #ifdef LANG_BR
00298   else if (L_EQUAL("brazilian"))
00299   {
00300     theTranslator=new TranslatorDecoder(new TranslatorBrazilian);
00301   }
00302 #endif
00303 #ifdef LANG_DK
00304   else if (L_EQUAL("danish"))
00305   {
00306     theTranslator=new TranslatorDecoder(new TranslatorDanish);
00307   }
00308 #endif
00309 #ifdef LANG_SK
00310   else if (L_EQUAL("slovak"))
00311   {
00312     theTranslator=new TranslatorDecoder(new TranslatorSlovak);
00313   }
00314 #endif
00315 #ifdef LANG_UA
00316   else if (L_EQUAL("ukrainian"))
00317   {
00318     theTranslator=new TranslatorDecoder(new TranslatorUkrainian);
00319   }
00320 #endif
00321 #ifdef LANG_GR
00322   else if (L_EQUAL("greek"))
00323   {
00324     theTranslator=new TranslatorDecoder(new TranslatorGreek);
00325   }
00326 #endif
00327 #ifdef LANG_SR
00328   else if (L_EQUAL("serbian"))
00329   {
00330     theTranslator=new TranslatorDecoder(new TranslatorSerbian);
00331   }
00332 #endif
00333 #ifdef LANG_CA
00334   else if (L_EQUAL("catalan"))
00335   {
00336     theTranslator=new TranslatorDecoder(new TranslatorCatalan);
00337   }
00338 #endif
00339 #ifdef LANG_LT
00340   else if (L_EQUAL("lithuanian"))
00341   {
00342     theTranslator=new TranslatorDecoder(new TranslatorLithuanian);
00343   }
00344 #endif
00345 #ifdef LANG_ZA
00346   else if (L_EQUAL("afrikaans"))
00347   {
00348     theTranslator=new TranslatorDecoder(new TranslatorAfrikaans);
00349   }
00350 #endif
00351 #ifdef LANG_AR
00352   else if (L_EQUAL("arabic"))
00353   {
00354     theTranslator=new TranslatorDecoder(new TranslatorArabic);
00355   }
00356 #endif
00357 #ifdef LANG_FA
00358   else if (L_EQUAL("persian") || L_EQUAL("farsi"))
00359   {
00360     theTranslator=new TranslatorDecoder(new TranslatorPersian);
00361   }
00362 #endif
00363 #ifdef LANG_MK
00364   else if (L_EQUAL("macedonian"))
00365   {
00366     theTranslator=new TranslatorMacedonian;
00367   }
00368 #endif
00369 #endif // ENGLISH_ONLY
00370   else // use the default language (i.e. english)
00371   {
00372     theTranslator=new TranslatorEnglish;
00373     return FALSE;
00374   }
00375   
00376   QCString msg = theTranslator->updateNeededMessage();
00377   if (!msg.isEmpty()) warn_cont(msg);
00378   return TRUE;
00379 }



Generated on Mon Mar 31 10:58:39 2008 by  doxygen 1.5.1