summaryrefslogtreecommitdiff
path: root/src/language.cpp
blob: 299c452c530a68b9f8125e128d4e066a0704abc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
/******************************************************************************
 *
 *
 *
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
 *
 * 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.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#include "message.h"
#include "config.h"
#include "util.h"
#include "language.h"
#include "lang_cfg.h"
#include "translator.h"
#include "translator_en.h"
#if !defined(ENGLISH_ONLY)
#include "translator_adapter.h"
#ifdef LANG_NL
#include "translator_nl.h"
#endif
#ifdef LANG_AM
#include "translator_am.h"
#endif
#ifdef LANG_SV
#include "translator_sv.h"
#endif
#ifdef LANG_CZ
#include "translator_cz.h"
#endif
#ifdef LANG_FR
#include "translator_fr.h"
#endif
#ifdef LANG_ID
#include "translator_id.h"
#endif
#ifdef LANG_IT
#include "translator_it.h"
#endif
#ifdef LANG_DE
#include "translator_de.h"
#endif
#ifdef LANG_JP
#include "translator_jp.h"
#endif
#ifdef LANG_JE
#include "translator_je.h"
#endif
#ifdef LANG_ES
#include "translator_es.h"
#endif
#ifdef LANG_EO
#include "translator_eo.h"
#endif
#ifdef LANG_FI
#include "translator_fi.h"
#endif
#ifdef LANG_RU
#include "translator_ru.h"
#endif
#ifdef LANG_HR
#include "translator_hr.h"
#endif
#ifdef LANG_PL
#include "translator_pl.h"
#endif
#ifdef LANG_PT
#include "translator_pt.h"
#endif
#ifdef LANG_HU
#include "translator_hu.h"
#endif
#ifdef LANG_KE
#include "translator_ke.h"
#endif
#ifdef LANG_KR
#include "translator_kr.h"
#endif
#ifdef LANG_RO
#include "translator_ro.h"
#endif
#ifdef LANG_SI
#include "translator_si.h"
#endif
#ifdef LANG_CN
#include "translator_cn.h"
#endif
#ifdef LANG_TW
#include "translator_tw.h"
#endif
#ifdef LANG_NO
#include "translator_no.h"
#endif
#ifdef LANG_BR
#include "translator_br.h"
#endif
#ifdef LANG_DK
#include "translator_dk.h"
#endif
#ifdef LANG_SK
#include "translator_sk.h"
#endif
#ifdef LANG_UA
#include "translator_ua.h"
#endif
#ifdef LANG_GR
#include "translator_gr.h"
#endif
#ifdef LANG_SR
#include "translator_sr.h"
#endif
#ifdef LANG_CA
#include "translator_ca.h"
#endif
//#ifdef LANG_JS
//#include "translator_js.h"
//#endif
#ifdef LANG_LT
#include "translator_lt.h"
#endif
#ifdef LANG_LV
#include "translator_lv.h"
#endif
#ifdef LANG_ZA
#include "translator_za.h"
#endif
#ifdef LANG_AR
#include "translator_ar.h"
#endif
#ifdef LANG_FA
#include "translator_fa.h"
#endif
#ifdef LANG_MK
#include "translator_mk.h"
#endif
#ifdef LANG_SC
#include "translator_sc.h"
#endif
#ifdef LANG_VI
#include "translator_vi.h"
#endif
#ifdef LANG_TR
#include "translator_tr.h"
#endif
#endif // !ENGLISH_ONLY

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

Translator *theTranslator=0;

bool setTranslator(const char *langName)
{
  if (L_EQUAL("english"))
  {
    theTranslator=new TranslatorEnglish;
  }
#if !defined(ENGLISH_ONLY)
#ifdef LANG_NL
  else if (L_EQUAL("dutch"))
  {
    theTranslator=new TranslatorDutch;
  }
#endif
#ifdef LANG_AM
  else if (L_EQUAL("armenian"))
  {
    theTranslator=new TranslatorArmenian;
  }
#endif
#ifdef LANG_SV
  else if (L_EQUAL("swedish"))
  {
    theTranslator=new TranslatorSwedish;
  }
#endif
#ifdef LANG_CZ
  else if (L_EQUAL("czech"))
  {
    theTranslator=new TranslatorCzech;
  }
#endif
#ifdef LANG_FR
  else if (L_EQUAL("french"))
  {
    theTranslator=new TranslatorFrench;
  }
#endif
#ifdef LANG_ID
  else if (L_EQUAL("indonesian"))
  {
    theTranslator=new TranslatorIndonesian;
  }
#endif
#ifdef LANG_IT
  else if (L_EQUAL("italian"))
  {
    theTranslator=new TranslatorItalian;
  }
#endif
#ifdef LANG_DE
  else if (L_EQUAL("german"))
  {
    theTranslator=new TranslatorGerman;
  }
#endif
#ifdef LANG_JP
  else if (L_EQUAL("japanese"))
  {
    theTranslator=new TranslatorJapanese;
  }
#endif
#ifdef LANG_JE
  else if (L_EQUAL("japanese-en"))
  {
    theTranslator=new TranslatorJapaneseEn;
  }
#endif
#ifdef LANG_ES
  else if (L_EQUAL("spanish"))
  {
    theTranslator=new TranslatorSpanish;
  }
#endif
#ifdef LANG_FI
  else if (L_EQUAL("finnish"))
  {
    theTranslator=new TranslatorFinnish;
  }
#endif
#ifdef LANG_RU
  else if (L_EQUAL("russian"))
  {
    theTranslator=new TranslatorRussian;
  }
#endif
#ifdef LANG_HR
  else if (L_EQUAL("croatian"))
  {
    theTranslator=new TranslatorCroatian;
  }
#endif
#ifdef LANG_PL
  else if (L_EQUAL("polish"))
  {
    theTranslator=new TranslatorPolish;
  }
#endif
#ifdef LANG_PT
  else if (L_EQUAL("portuguese"))
  {
    theTranslator=new TranslatorPortuguese;
  }
#endif
#ifdef LANG_HU
  else if (L_EQUAL("hungarian"))
  {
    theTranslator=new TranslatorHungarian;
  }
#endif
#ifdef LANG_KR
  else if (L_EQUAL("korean"))
  {
    theTranslator=new TranslatorKorean;
  }
#endif
#ifdef LANG_KE
  else if (L_EQUAL("korean-en"))
  {
    theTranslator=new TranslatorKoreanEn;
  }
#endif
#ifdef LANG_RO
  else if (L_EQUAL("romanian"))
  {
    theTranslator=new TranslatorRomanian;
  }
#endif
#ifdef LANG_SI
  else if (L_EQUAL("slovene"))
  {
    theTranslator=new TranslatorSlovene;
  }
#endif
#ifdef LANG_CN
  else if (L_EQUAL("chinese"))
  {
    theTranslator=new TranslatorChinese;
  }
#endif
#ifdef LANG_TW
  else if (L_EQUAL("chinese-traditional"))
  {
    theTranslator=new TranslatorChinesetraditional;
  }
#endif
#ifdef LANG_NO
  else if (L_EQUAL("norwegian"))
  {
    theTranslator=new TranslatorNorwegian;
  }
#endif
#ifdef LANG_BR
  else if (L_EQUAL("brazilian"))
  {
    theTranslator=new TranslatorBrazilian;
  }
#endif
#ifdef LANG_DK
  else if (L_EQUAL("danish"))
  {
    theTranslator=new TranslatorDanish;
  }
#endif
#ifdef LANG_SK
  else if (L_EQUAL("slovak"))
  {
    theTranslator=new TranslatorSlovak;
  }
#endif
#ifdef LANG_UA
  else if (L_EQUAL("ukrainian"))
  {
    theTranslator=new TranslatorUkrainian;
  }
#endif
#ifdef LANG_GR
  else if (L_EQUAL("greek"))
  {
    theTranslator=new TranslatorGreek;
  }
#endif
#ifdef LANG_SR
  else if (L_EQUAL("serbian"))
  {
    theTranslator=new TranslatorSerbian;
  }
#endif
#ifdef LANG_SC
  else if (L_EQUAL("serbian-cyrillic") || L_EQUAL("serbiancyr")) /* serbiancyr for consistency with older versions */
  {
    theTranslator=new TranslatorSerbianCyrillic;
  }
#endif
#ifdef LANG_CA
  else if (L_EQUAL("catalan"))
  {
    theTranslator=new TranslatorCatalan;
  }
#endif
#ifdef LANG_LT
  else if (L_EQUAL("lithuanian"))
  {
    theTranslator=new TranslatorLithuanian;
  }
#endif
#ifdef LANG_LV
  else if (L_EQUAL("latvian"))
  {
    theTranslator=new TranslatorLatvian;
  }
#endif
#ifdef LANG_ZA
  else if (L_EQUAL("afrikaans"))
  {
    theTranslator=new TranslatorAfrikaans;
  }
#endif
#ifdef LANG_AR
  else if (L_EQUAL("arabic"))
  {
    theTranslator=new TranslatorArabic;
  }
#endif
#ifdef LANG_FA
  else if (L_EQUAL("persian") || L_EQUAL("farsi"))
  {
    theTranslator=new TranslatorPersian;
  }
#endif
#ifdef LANG_MK
  else if (L_EQUAL("macedonian"))
  {
    theTranslator=new TranslatorMacedonian;
  }
#endif
#ifdef LANG_VI
  else if (L_EQUAL("vietnamese"))
  {
    theTranslator=new TranslatorVietnamese;
  }
#endif
#ifdef LANG_TR
  else if (L_EQUAL("turkish"))
  {
    theTranslator=new TranslatorTurkish;
  }
#endif
#ifdef LANG_EO
  else if (L_EQUAL("esperanto"))
  {
    theTranslator=new TranslatorEsperanto;
  }
#endif
#endif // ENGLISH_ONLY
  else // use the default language (i.e. english)
  {
    theTranslator=new TranslatorEnglish;
    return FALSE;
  }

  QCString msg = theTranslator->updateNeededMessage();
  if (!msg.isEmpty()) warn_uncond("%s", msg.data());
  return TRUE;
}