Orb/Doxygen/src/language.cpp
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     6  *
       
     7  * Permission to use, copy, modify, and distribute this software and its
       
     8  * documentation under the terms of the GNU General Public License is hereby 
       
     9  * granted. No representations are made about the suitability of this software 
       
    10  * for any purpose. It is provided "as is" without express or implied warranty.
       
    11  * See the GNU General Public License for more details.
       
    12  *
       
    13  * Documents produced by Doxygen are derivative works derived from the
       
    14  * input used in their production; they are not affected by this license.
       
    15  *
       
    16  */
       
    17 
       
    18 #include "message.h"
       
    19 #include "language.h"
       
    20 #include "lang_cfg.h"
       
    21 #include "translator.h"
       
    22 #include "translatordecoder.h"
       
    23 #include "translator_en.h"
       
    24 #if !defined(ENGLISH_ONLY)
       
    25 #include "translator_adapter.h"
       
    26 #ifdef LANG_NL
       
    27 #include "translator_nl.h"
       
    28 #endif
       
    29 #ifdef LANG_SV
       
    30 #include "translator_sv.h"
       
    31 #endif
       
    32 #ifdef LANG_CZ
       
    33 #include "translator_cz.h"
       
    34 #endif
       
    35 #ifdef LANG_FR
       
    36 #include "translator_fr.h"
       
    37 #endif
       
    38 #ifdef LANG_ID
       
    39 #include "translator_id.h"
       
    40 #endif
       
    41 #ifdef LANG_IT
       
    42 #include "translator_it.h"
       
    43 #endif
       
    44 #ifdef LANG_DE
       
    45 #include "translator_de.h"
       
    46 #endif
       
    47 #ifdef LANG_JP
       
    48 #include "translator_jp.h"
       
    49 #endif
       
    50 #ifdef LANG_JE
       
    51 #include "translator_je.h"
       
    52 #endif
       
    53 #ifdef LANG_ES
       
    54 #include "translator_es.h"
       
    55 #endif
       
    56 #ifdef LANG_EO
       
    57 #include "translator_eo.h"
       
    58 #endif
       
    59 #ifdef LANG_FI
       
    60 #include "translator_fi.h"
       
    61 #endif
       
    62 #ifdef LANG_RU
       
    63 #include "translator_ru.h"
       
    64 #endif
       
    65 #ifdef LANG_HR
       
    66 #include "translator_hr.h"
       
    67 #endif
       
    68 #ifdef LANG_PL
       
    69 #include "translator_pl.h"
       
    70 #endif
       
    71 #ifdef LANG_PT
       
    72 #include "translator_pt.h"
       
    73 #endif
       
    74 #ifdef LANG_HU
       
    75 #include "translator_hu.h"
       
    76 #endif
       
    77 #ifdef LANG_KE
       
    78 #include "translator_ke.h"
       
    79 #endif
       
    80 #ifdef LANG_KR
       
    81 #include "translator_kr.h"
       
    82 #endif
       
    83 #ifdef LANG_RO
       
    84 #include "translator_ro.h"
       
    85 #endif
       
    86 #ifdef LANG_SI
       
    87 #include "translator_si.h"
       
    88 #endif
       
    89 #ifdef LANG_CN
       
    90 #include "translator_cn.h"
       
    91 #endif
       
    92 #ifdef LANG_TW
       
    93 #include "translator_tw.h"
       
    94 #endif
       
    95 #ifdef LANG_NO
       
    96 #include "translator_no.h"
       
    97 #endif
       
    98 #ifdef LANG_BR
       
    99 #include "translator_br.h"
       
   100 #endif
       
   101 #ifdef LANG_DK
       
   102 #include "translator_dk.h"
       
   103 #endif
       
   104 #ifdef LANG_SK
       
   105 #include "translator_sk.h"
       
   106 #endif
       
   107 #ifdef LANG_UA
       
   108 #include "translator_ua.h"
       
   109 #endif
       
   110 #ifdef LANG_GR
       
   111 #include "translator_gr.h"
       
   112 #endif
       
   113 #ifdef LANG_SR
       
   114 #include "translator_sr.h"
       
   115 #endif
       
   116 #ifdef LANG_CA
       
   117 #include "translator_ca.h"
       
   118 #endif
       
   119 //#ifdef LANG_JS
       
   120 //#include "translator_js.h"
       
   121 //#endif
       
   122 #ifdef LANG_LT
       
   123 #include "translator_lt.h"
       
   124 #endif
       
   125 #ifdef LANG_ZA
       
   126 #include "translator_za.h"
       
   127 #endif
       
   128 #ifdef LANG_AR
       
   129 #include "translator_ar.h"
       
   130 #endif
       
   131 #ifdef LANG_FA
       
   132 #include "translator_fa.h"
       
   133 #endif
       
   134 #ifdef LANG_MK
       
   135 #include "translator_mk.h"
       
   136 #endif
       
   137 #ifdef LANG_SC
       
   138 #include "translator_sc.h"
       
   139 #endif
       
   140 #ifdef LANG_VI
       
   141 #include "translator_vi.h"
       
   142 #endif
       
   143 #ifdef LANG_TR
       
   144 #include "translator_tr.h"
       
   145 #endif
       
   146 #endif // !ENGLISH_ONLY
       
   147 
       
   148 #define L_EQUAL(a) !stricmp(langName,a)
       
   149 
       
   150 Translator *theTranslator=0;
       
   151 
       
   152 static const char obsoleteMsg[] =
       
   153         "---------\n"
       
   154         "ERROR: The selected language is no longer supported!\n"
       
   155         "If you want doxygen to produce output in this language \n"
       
   156         "you are kindly requested to help bringing the documentation \n"
       
   157         "up to date. Please read the development section of the manual \n"
       
   158         "for more information or contact Petr Prikryl (Prikryl@skil.cz).\n"
       
   159         "Thanks in advance!\n"
       
   160         "---------\n";
       
   161 
       
   162 bool setTranslator(const char *langName)
       
   163 {
       
   164   if (L_EQUAL("english"))
       
   165   {
       
   166     theTranslator=new TranslatorEnglish;
       
   167   }
       
   168 #if !defined(ENGLISH_ONLY)
       
   169 #ifdef LANG_NL
       
   170   else if (L_EQUAL("dutch"))
       
   171   {
       
   172     theTranslator=new TranslatorDutch;
       
   173   }
       
   174 #endif
       
   175 #ifdef LANG_SV
       
   176   else if (L_EQUAL("swedish"))
       
   177   {
       
   178     theTranslator=new TranslatorDecoder(new TranslatorSwedish);
       
   179   }
       
   180 #endif
       
   181 #ifdef LANG_CZ
       
   182   else if (L_EQUAL("czech"))
       
   183   {
       
   184     theTranslator=new TranslatorCzech;
       
   185   }
       
   186 #endif
       
   187 #ifdef LANG_FR  
       
   188   else if (L_EQUAL("french"))
       
   189   {
       
   190     theTranslator=new TranslatorDecoder(new TranslatorFrench);
       
   191   }
       
   192 #endif
       
   193 #ifdef LANG_ID  
       
   194   else if (L_EQUAL("indonesian"))
       
   195   {
       
   196     theTranslator=new TranslatorDecoder(new TranslatorIndonesian);
       
   197   }
       
   198 #endif
       
   199 #ifdef LANG_IT  
       
   200   else if (L_EQUAL("italian"))
       
   201   {
       
   202     theTranslator=new TranslatorItalian;
       
   203   }
       
   204 #endif
       
   205 #ifdef LANG_DE
       
   206   else if (L_EQUAL("german"))
       
   207   {
       
   208     theTranslator=new TranslatorDecoder(new TranslatorGerman);
       
   209   }
       
   210 #endif
       
   211 #ifdef LANG_JP
       
   212   else if (L_EQUAL("japanese"))
       
   213   {
       
   214     theTranslator=new TranslatorDecoder(new TranslatorJapanese);
       
   215   }
       
   216 #endif
       
   217 #ifdef LANG_JE
       
   218   else if (L_EQUAL("japanese-en"))
       
   219   {
       
   220     theTranslator=new TranslatorDecoder(new TranslatorJapaneseEn);
       
   221   }
       
   222 #endif
       
   223 #ifdef LANG_ES
       
   224   else if (L_EQUAL("spanish"))
       
   225   {
       
   226     theTranslator=new TranslatorDecoder(new TranslatorSpanish);
       
   227   }
       
   228 #endif
       
   229 #ifdef LANG_FI
       
   230   else if (L_EQUAL("finnish"))
       
   231   {
       
   232     theTranslator=new TranslatorFinnish;
       
   233   }
       
   234 #endif
       
   235 #ifdef LANG_RU
       
   236   else if (L_EQUAL("russian"))
       
   237   {
       
   238     theTranslator=new TranslatorDecoder(new TranslatorRussian);
       
   239   }
       
   240 #endif
       
   241 #ifdef LANG_HR
       
   242   else if (L_EQUAL("croatian"))
       
   243   {
       
   244     theTranslator=new TranslatorDecoder(new TranslatorCroatian);
       
   245   }
       
   246 #endif
       
   247 #ifdef LANG_PL
       
   248   else if (L_EQUAL("polish"))
       
   249   {
       
   250     theTranslator=new TranslatorDecoder(new TranslatorPolish);
       
   251   }
       
   252 #endif
       
   253 #ifdef LANG_PT
       
   254   else if (L_EQUAL("portuguese"))
       
   255   {
       
   256     theTranslator=new TranslatorDecoder(new TranslatorPortuguese);
       
   257   }
       
   258 #endif
       
   259 #ifdef LANG_HU
       
   260   else if (L_EQUAL("hungarian"))
       
   261   {
       
   262     theTranslator=new TranslatorDecoder(new TranslatorHungarian);
       
   263   }
       
   264 #endif
       
   265 #ifdef LANG_KR
       
   266   else if (L_EQUAL("korean"))
       
   267   {
       
   268     theTranslator=new TranslatorDecoder(new TranslatorKorean);
       
   269   }
       
   270 #endif
       
   271 #ifdef LANG_KE
       
   272   else if (L_EQUAL("korean-en"))
       
   273   {
       
   274     theTranslator=new TranslatorDecoder(new TranslatorKoreanEn);
       
   275   }
       
   276 #endif
       
   277 #ifdef LANG_RO
       
   278   else if (L_EQUAL("romanian"))
       
   279   {
       
   280     theTranslator=new TranslatorDecoder(new TranslatorRomanian);
       
   281   }
       
   282 #endif
       
   283 #ifdef LANG_SI
       
   284   else if (L_EQUAL("slovene"))
       
   285   {
       
   286     theTranslator=new TranslatorDecoder(new TranslatorSlovene);
       
   287   }
       
   288 #endif
       
   289 #ifdef LANG_CN
       
   290   else if (L_EQUAL("chinese"))
       
   291   {
       
   292     theTranslator=new TranslatorDecoder(new TranslatorChinese);
       
   293   }
       
   294 #endif
       
   295 #ifdef LANG_TW
       
   296   else if (L_EQUAL("chinese-traditional"))
       
   297   {
       
   298     theTranslator=new TranslatorDecoder(new TranslatorChinesetraditional);
       
   299   }
       
   300 #endif
       
   301 #ifdef LANG_NO
       
   302   else if (L_EQUAL("norwegian"))
       
   303   {
       
   304     theTranslator=new TranslatorDecoder(new TranslatorNorwegian);
       
   305   }
       
   306 #endif
       
   307 #ifdef LANG_BR
       
   308   else if (L_EQUAL("brazilian"))
       
   309   {
       
   310     theTranslator=new TranslatorDecoder(new TranslatorBrazilian);
       
   311   }
       
   312 #endif
       
   313 #ifdef LANG_DK
       
   314   else if (L_EQUAL("danish"))
       
   315   {
       
   316     theTranslator=new TranslatorDecoder(new TranslatorDanish);
       
   317   }
       
   318 #endif
       
   319 #ifdef LANG_SK
       
   320   else if (L_EQUAL("slovak"))
       
   321   {
       
   322     theTranslator=new TranslatorDecoder(new TranslatorSlovak);
       
   323   }
       
   324 #endif
       
   325 #ifdef LANG_UA
       
   326   else if (L_EQUAL("ukrainian"))
       
   327   {
       
   328     theTranslator=new TranslatorDecoder(new TranslatorUkrainian);
       
   329   }
       
   330 #endif
       
   331 #ifdef LANG_GR
       
   332   else if (L_EQUAL("greek"))
       
   333   {
       
   334     theTranslator=new TranslatorDecoder(new TranslatorGreek);
       
   335   }
       
   336 #endif
       
   337 #ifdef LANG_SR
       
   338   else if (L_EQUAL("serbian"))
       
   339   {
       
   340     theTranslator=new TranslatorDecoder(new TranslatorSerbian);
       
   341   }
       
   342 #endif
       
   343 #ifdef LANG_SC
       
   344   else if (L_EQUAL("serbian-cyrilic"))
       
   345   {
       
   346     theTranslator=new TranslatorSerbian;
       
   347   }
       
   348 #endif
       
   349 #ifdef LANG_CA
       
   350   else if (L_EQUAL("catalan"))
       
   351   {
       
   352     theTranslator=new TranslatorCatalan;
       
   353   }
       
   354 #endif
       
   355 #ifdef LANG_LT
       
   356   else if (L_EQUAL("lithuanian"))
       
   357   {
       
   358     theTranslator=new TranslatorDecoder(new TranslatorLithuanian);
       
   359   }
       
   360 #endif
       
   361 #ifdef LANG_ZA
       
   362   else if (L_EQUAL("afrikaans"))
       
   363   {
       
   364     theTranslator=new TranslatorDecoder(new TranslatorAfrikaans);
       
   365   }
       
   366 #endif
       
   367 #ifdef LANG_AR
       
   368   else if (L_EQUAL("arabic"))
       
   369   {
       
   370     theTranslator=new TranslatorDecoder(new TranslatorArabic);
       
   371   }
       
   372 #endif
       
   373 #ifdef LANG_FA
       
   374   else if (L_EQUAL("persian") || L_EQUAL("farsi"))
       
   375   {
       
   376     theTranslator=new TranslatorDecoder(new TranslatorPersian);
       
   377   }
       
   378 #endif
       
   379 #ifdef LANG_MK
       
   380   else if (L_EQUAL("macedonian"))
       
   381   {
       
   382     theTranslator=new TranslatorMacedonian;
       
   383   }
       
   384 #endif
       
   385 #ifdef LANG_VI
       
   386   else if (L_EQUAL("vietnamese"))
       
   387   {
       
   388     theTranslator=new TranslatorVietnamese;
       
   389   }
       
   390 #endif
       
   391 #ifdef LANG_TR
       
   392   else if (L_EQUAL("turkish"))
       
   393   {
       
   394     theTranslator=new TranslatorTurkish;
       
   395   }
       
   396 #endif
       
   397 #ifdef LANG_EO
       
   398   else if (L_EQUAL("esperanto"))
       
   399   {
       
   400     theTranslator=new TranslatorEsperanto;
       
   401   }
       
   402 #endif
       
   403 #endif // ENGLISH_ONLY
       
   404   else // use the default language (i.e. english)
       
   405   {
       
   406     theTranslator=new TranslatorEnglish;
       
   407     return FALSE;
       
   408   }
       
   409   
       
   410   QCString msg = theTranslator->updateNeededMessage();
       
   411   if (!msg.isEmpty()) warn_cont(msg);
       
   412   return TRUE;
       
   413 }