language.cpp 8.16 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4
 *
5
 * Copyright (C) 1997-2011 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6 7 8 9 10 11 12
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
13 14
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
15 16 17
 *
 */

Dimitri van Heesch's avatar
Dimitri van Heesch committed
18
#include "message.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
19
#include "language.h"
20
#include "lang_cfg.h"
21
#include "translator.h"
22
#include "translatordecoder.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
23
#include "translator_en.h"
24
#if !defined(ENGLISH_ONLY)
25
#include "translator_adapter.h"
26
#ifdef LANG_NL
Dimitri van Heesch's avatar
Dimitri van Heesch committed
27
#include "translator_nl.h"
28
#endif
29 30
#ifdef LANG_SV
#include "translator_sv.h"
31 32
#endif
#ifdef LANG_CZ
Dimitri van Heesch's avatar
Dimitri van Heesch committed
33
#include "translator_cz.h"
34 35
#endif
#ifdef LANG_FR
Dimitri van Heesch's avatar
Dimitri van Heesch committed
36
#include "translator_fr.h"
37
#endif
38 39 40
#ifdef LANG_ID
#include "translator_id.h"
#endif
41
#ifdef LANG_IT
Dimitri van Heesch's avatar
Dimitri van Heesch committed
42
#include "translator_it.h"
43 44
#endif
#ifdef LANG_DE
45
#include "translator_de.h"
46 47
#endif
#ifdef LANG_JP
48
#include "translator_jp.h"
49
#endif
50 51 52
#ifdef LANG_JE
#include "translator_je.h"
#endif
53
#ifdef LANG_ES
54
#include "translator_es.h"
55
#endif
56 57 58
#ifdef LANG_EO
#include "translator_eo.h"
#endif
59
#ifdef LANG_FI
60
#include "translator_fi.h"
61 62
#endif
#ifdef LANG_RU
63
#include "translator_ru.h"
64 65
#endif
#ifdef LANG_HR
66
#include "translator_hr.h"
67 68
#endif
#ifdef LANG_PL
69
#include "translator_pl.h"
70 71
#endif
#ifdef LANG_PT
Dimitri van Heesch's avatar
Dimitri van Heesch committed
72
#include "translator_pt.h"
73 74
#endif
#ifdef LANG_HU
75
#include "translator_hu.h"
76
#endif
77 78 79
#ifdef LANG_KE
#include "translator_ke.h"
#endif
80
#ifdef LANG_KR
Dimitri van Heesch's avatar
Dimitri van Heesch committed
81
#include "translator_kr.h"
82 83
#endif
#ifdef LANG_RO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
84
#include "translator_ro.h"
85 86
#endif
#ifdef LANG_SI
87
#include "translator_si.h"
88 89
#endif
#ifdef LANG_CN
90
#include "translator_cn.h"
91
#endif
92 93 94
#ifdef LANG_TW
#include "translator_tw.h"
#endif
95
#ifdef LANG_NO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
96
#include "translator_no.h"
97 98
#endif
#ifdef LANG_BR
99
#include "translator_br.h"
100 101
#endif
#ifdef LANG_DK
Dimitri van Heesch's avatar
Dimitri van Heesch committed
102
#include "translator_dk.h"
103 104
#endif
#ifdef LANG_SK
Dimitri van Heesch's avatar
Dimitri van Heesch committed
105
#include "translator_sk.h"
106 107
#endif
#ifdef LANG_UA
108
#include "translator_ua.h"
109
#endif
Dimitri van Heesch's avatar
Dimitri van Heesch committed
110 111 112
#ifdef LANG_GR
#include "translator_gr.h"
#endif
113 114 115
#ifdef LANG_SR
#include "translator_sr.h"
#endif
116 117 118
#ifdef LANG_CA
#include "translator_ca.h"
#endif
Dimitri van Heesch's avatar
Dimitri van Heesch committed
119 120 121
//#ifdef LANG_JS
//#include "translator_js.h"
//#endif
122 123 124
#ifdef LANG_LT
#include "translator_lt.h"
#endif
125 126 127
#ifdef LANG_ZA
#include "translator_za.h"
#endif
128 129
#ifdef LANG_AR
#include "translator_ar.h"
130
#endif
131 132 133
#ifdef LANG_FA
#include "translator_fa.h"
#endif
134 135 136
#ifdef LANG_MK
#include "translator_mk.h"
#endif
137 138 139
#ifdef LANG_SC
#include "translator_sc.h"
#endif
140 141 142
#ifdef LANG_VI
#include "translator_vi.h"
#endif
143 144 145
#ifdef LANG_TR
#include "translator_tr.h"
#endif
146
#endif // !ENGLISH_ONLY
Dimitri van Heesch's avatar
Dimitri van Heesch committed
147 148 149 150 151

#define L_EQUAL(a) !stricmp(langName,a)

Translator *theTranslator=0;

152 153 154 155 156 157 158 159 160 161
static const char obsoleteMsg[] =
        "---------\n"
        "ERROR: The selected language is no longer supported!\n"
        "If you want doxygen to produce output in this language \n"
        "you are kindly requested to help bringing the documentation \n"
        "up to date. Please read the development section of the manual \n"
        "for more information or contact Petr Prikryl (Prikryl@skil.cz).\n"
        "Thanks in advance!\n"
        "---------\n";

Dimitri van Heesch's avatar
Dimitri van Heesch committed
162 163 164 165
bool setTranslator(const char *langName)
{
  if (L_EQUAL("english"))
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
166
    theTranslator=new TranslatorEnglish;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
167
  }
168
#if !defined(ENGLISH_ONLY)
169
#ifdef LANG_NL
Dimitri van Heesch's avatar
Dimitri van Heesch committed
170 171 172 173
  else if (L_EQUAL("dutch"))
  {
    theTranslator=new TranslatorDutch;
  }
174
#endif
175
#ifdef LANG_SV
Dimitri van Heesch's avatar
Dimitri van Heesch committed
176 177
  else if (L_EQUAL("swedish"))
  {
178
    theTranslator=new TranslatorDecoder(new TranslatorSwedish);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
179
  }
180 181
#endif
#ifdef LANG_CZ
Dimitri van Heesch's avatar
Dimitri van Heesch committed
182 183
  else if (L_EQUAL("czech"))
  {
184
    theTranslator=new TranslatorCzech;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
185
  }
186 187
#endif
#ifdef LANG_FR  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
188 189
  else if (L_EQUAL("french"))
  {
190
    theTranslator=new TranslatorDecoder(new TranslatorFrench);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
191
  }
192
#endif
193 194 195
#ifdef LANG_ID  
  else if (L_EQUAL("indonesian"))
  {
196
    theTranslator=new TranslatorDecoder(new TranslatorIndonesian);
197 198
  }
#endif
199
#ifdef LANG_IT  
Dimitri van Heesch's avatar
Dimitri van Heesch committed
200 201
  else if (L_EQUAL("italian"))
  {
202
    theTranslator=new TranslatorItalian;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
203
  }
204 205
#endif
#ifdef LANG_DE
206 207
  else if (L_EQUAL("german"))
  {
208
    theTranslator=new TranslatorGerman;
209
  }
210 211
#endif
#ifdef LANG_JP
212 213
  else if (L_EQUAL("japanese"))
  {
214
    theTranslator=new TranslatorDecoder(new TranslatorJapanese);
215
  }
216 217
#endif
#ifdef LANG_JE
218 219
  else if (L_EQUAL("japanese-en"))
  {
220
    theTranslator=new TranslatorDecoder(new TranslatorJapaneseEn);
221
  }
222 223
#endif
#ifdef LANG_ES
224 225
  else if (L_EQUAL("spanish"))
  {
226
    theTranslator=new TranslatorSpanish;
227
  }
228 229
#endif
#ifdef LANG_FI
230 231
  else if (L_EQUAL("finnish"))
  {
232
    theTranslator=new TranslatorFinnish;
233
  }
234 235
#endif
#ifdef LANG_RU
236 237
  else if (L_EQUAL("russian"))
  {
238
    theTranslator=new TranslatorDecoder(new TranslatorRussian);
239
  }
240 241
#endif
#ifdef LANG_HR
242 243
  else if (L_EQUAL("croatian"))
  {
244
    theTranslator=new TranslatorCroatian;
245
  }
246 247
#endif
#ifdef LANG_PL
248 249
  else if (L_EQUAL("polish"))
  {
250
    theTranslator=new TranslatorPolish;
251
  }
252 253
#endif
#ifdef LANG_PT
Dimitri van Heesch's avatar
Dimitri van Heesch committed
254 255
  else if (L_EQUAL("portuguese"))
  {
256
    theTranslator=new TranslatorDecoder(new TranslatorPortuguese);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
257
  }
258 259
#endif
#ifdef LANG_HU
260 261
  else if (L_EQUAL("hungarian"))
  {
262
    theTranslator=new TranslatorDecoder(new TranslatorHungarian);
263
  }
264 265
#endif
#ifdef LANG_KR
Dimitri van Heesch's avatar
Dimitri van Heesch committed
266 267
  else if (L_EQUAL("korean"))
  {
268
    theTranslator=new TranslatorDecoder(new TranslatorKorean);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
269
  }
270 271
#endif
#ifdef LANG_KE
272 273
  else if (L_EQUAL("korean-en"))
  {
274
    theTranslator=new TranslatorDecoder(new TranslatorKoreanEn);
275
  }
276 277
#endif
#ifdef LANG_RO
Dimitri van Heesch's avatar
Dimitri van Heesch committed
278 279
  else if (L_EQUAL("romanian"))
  {
280
    theTranslator=new TranslatorDecoder(new TranslatorRomanian);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
281
  }
282 283
#endif
#ifdef LANG_SI
284 285
  else if (L_EQUAL("slovene"))
  {
286
    theTranslator=new TranslatorDecoder(new TranslatorSlovene);
287
  }
288 289
#endif
#ifdef LANG_CN
290 291
  else if (L_EQUAL("chinese"))
  {
292
    theTranslator=new TranslatorDecoder(new TranslatorChinese);
293
  }
294
#endif
295 296 297
#ifdef LANG_TW
  else if (L_EQUAL("chinese-traditional"))
  {
298
    theTranslator=new TranslatorDecoder(new TranslatorChinesetraditional);
299 300
  }
#endif
301
#ifdef LANG_NO
302 303
  else if (L_EQUAL("norwegian"))
  {
304
    theTranslator=new TranslatorDecoder(new TranslatorNorwegian);
305
  }
306 307
#endif
#ifdef LANG_BR
308 309
  else if (L_EQUAL("brazilian"))
  {
310
    theTranslator=new TranslatorBrazilian;
311
  }
312 313
#endif
#ifdef LANG_DK
Dimitri van Heesch's avatar
Dimitri van Heesch committed
314 315
  else if (L_EQUAL("danish"))
  {
316
    theTranslator=new TranslatorDecoder(new TranslatorDanish);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
317
  }
318 319
#endif
#ifdef LANG_SK
Dimitri van Heesch's avatar
Dimitri van Heesch committed
320 321
  else if (L_EQUAL("slovak"))
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
322
    theTranslator=new TranslatorSlovak;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
323
  }
324 325
#endif
#ifdef LANG_UA
326 327
  else if (L_EQUAL("ukrainian"))
  {
328
    theTranslator=new TranslatorDecoder(new TranslatorUkrainian);
329
  }
330
#endif
Dimitri van Heesch's avatar
Dimitri van Heesch committed
331 332 333
#ifdef LANG_GR
  else if (L_EQUAL("greek"))
  {
334
    theTranslator=new TranslatorGreek;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
335 336
  }
#endif
337 338 339
#ifdef LANG_SR
  else if (L_EQUAL("serbian"))
  {
340
    theTranslator=new TranslatorDecoder(new TranslatorSerbian);
341
  }
342 343 344 345 346 347
#endif
#ifdef LANG_SC
  else if (L_EQUAL("serbian-cyrilic"))
  {
    theTranslator=new TranslatorSerbian;
  }
348
#endif
Dimitri van Heesch's avatar
Dimitri van Heesch committed
349 350 351
#ifdef LANG_CA
  else if (L_EQUAL("catalan"))
  {
352
    theTranslator=new TranslatorCatalan;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
353 354
  }
#endif
355 356 357
#ifdef LANG_LT
  else if (L_EQUAL("lithuanian"))
  {
358
    theTranslator=new TranslatorDecoder(new TranslatorLithuanian);
359 360
  }
#endif
361 362 363
#ifdef LANG_ZA
  else if (L_EQUAL("afrikaans"))
  {
364
    theTranslator=new TranslatorDecoder(new TranslatorAfrikaans);
365 366
  }
#endif
367 368 369
#ifdef LANG_AR
  else if (L_EQUAL("arabic"))
  {
370
    theTranslator=new TranslatorDecoder(new TranslatorArabic);
371 372 373
  }
#endif
#ifdef LANG_FA
Dimitri van Heesch's avatar
Dimitri van Heesch committed
374
  else if (L_EQUAL("persian") || L_EQUAL("farsi"))
375
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
376
    theTranslator=new TranslatorPersian;
377 378
  }
#endif
379 380 381 382 383 384
#ifdef LANG_MK
  else if (L_EQUAL("macedonian"))
  {
    theTranslator=new TranslatorMacedonian;
  }
#endif
385 386 387 388 389 390
#ifdef LANG_VI
  else if (L_EQUAL("vietnamese"))
  {
    theTranslator=new TranslatorVietnamese;
  }
#endif
391 392 393 394 395 396
#ifdef LANG_TR
  else if (L_EQUAL("turkish"))
  {
    theTranslator=new TranslatorTurkish;
  }
#endif
397 398 399 400 401 402
#ifdef LANG_EO
  else if (L_EQUAL("esperanto"))
  {
    theTranslator=new TranslatorEsperanto;
  }
#endif
403
#endif // ENGLISH_ONLY
Dimitri van Heesch's avatar
Dimitri van Heesch committed
404 405
  else // use the default language (i.e. english)
  {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
406
    theTranslator=new TranslatorEnglish;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
407 408
    return FALSE;
  }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
409 410
  
  QCString msg = theTranslator->updateNeededMessage();
411
  if (!msg.isEmpty()) err(msg);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
412 413
  return TRUE;
}