language.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 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 "config.h"
20 #include "util.h"
21 #include "language.h"
22 #include "lang_cfg.h"
23 #include "translator.h"
24 #include "translator_en.h"
25 #if !defined(ENGLISH_ONLY)
26 #include "translator_adapter.h"
27 #ifdef LANG_NL
28 #include "translator_nl.h"
29 #endif
30 #ifdef LANG_AM
31 #include "translator_am.h"
32 #endif
33 #ifdef LANG_SV
34 #include "translator_sv.h"
35 #endif
36 #ifdef LANG_CZ
37 #include "translator_cz.h"
38 #endif
39 #ifdef LANG_FR
40 #include "translator_fr.h"
41 #endif
42 #ifdef LANG_ID
43 #include "translator_id.h"
44 #endif
45 #ifdef LANG_IT
46 #include "translator_it.h"
47 #endif
48 #ifdef LANG_DE
49 #include "translator_de.h"
50 #endif
51 #ifdef LANG_JP
52 #include "translator_jp.h"
53 #endif
54 #ifdef LANG_JE
55 #include "translator_je.h"
56 #endif
57 #ifdef LANG_ES
58 #include "translator_es.h"
59 #endif
60 #ifdef LANG_EO
61 #include "translator_eo.h"
62 #endif
63 #ifdef LANG_FI
64 #include "translator_fi.h"
65 #endif
66 #ifdef LANG_RU
67 #include "translator_ru.h"
68 #endif
69 #ifdef LANG_HR
70 #include "translator_hr.h"
71 #endif
72 #ifdef LANG_PL
73 #include "translator_pl.h"
74 #endif
75 #ifdef LANG_PT
76 #include "translator_pt.h"
77 #endif
78 #ifdef LANG_HU
79 #include "translator_hu.h"
80 #endif
81 #ifdef LANG_KE
82 #include "translator_ke.h"
83 #endif
84 #ifdef LANG_KR
85 #include "translator_kr.h"
86 #endif
87 #ifdef LANG_RO
88 #include "translator_ro.h"
89 #endif
90 #ifdef LANG_SI
91 #include "translator_si.h"
92 #endif
93 #ifdef LANG_CN
94 #include "translator_cn.h"
95 #endif
96 #ifdef LANG_TW
97 #include "translator_tw.h"
98 #endif
99 #ifdef LANG_NO
100 #include "translator_no.h"
101 #endif
102 #ifdef LANG_BR
103 #include "translator_br.h"
104 #endif
105 #ifdef LANG_DK
106 #include "translator_dk.h"
107 #endif
108 #ifdef LANG_SK
109 #include "translator_sk.h"
110 #endif
111 #ifdef LANG_UA
112 #include "translator_ua.h"
113 #endif
114 #ifdef LANG_GR
115 #include "translator_gr.h"
116 #endif
117 #ifdef LANG_SR
118 #include "translator_sr.h"
119 #endif
120 #ifdef LANG_CA
121 #include "translator_ca.h"
122 #endif
123 //#ifdef LANG_JS
124 //#include "translator_js.h"
125 //#endif
126 #ifdef LANG_LT
127 #include "translator_lt.h"
128 #endif
129 #ifdef LANG_LV
130 #include "translator_lv.h"
131 #endif
132 #ifdef LANG_ZA
133 #include "translator_za.h"
134 #endif
135 #ifdef LANG_AR
136 #include "translator_ar.h"
137 #endif
138 #ifdef LANG_FA
139 #include "translator_fa.h"
140 #endif
141 #ifdef LANG_MK
142 #include "translator_mk.h"
143 #endif
144 #ifdef LANG_SC
145 #include "translator_sc.h"
146 #endif
147 #ifdef LANG_VI
148 #include "translator_vi.h"
149 #endif
150 #ifdef LANG_TR
151 #include "translator_tr.h"
152 #endif
153 #endif // !ENGLISH_ONLY
154 
155 #define L_EQUAL(a) !qstricmp(langName,a)
156 
158 
159 bool setTranslator(const char *langName)
160 {
161  if (L_EQUAL("english"))
162  {
163  theTranslator=new TranslatorEnglish;
164  }
165 #if !defined(ENGLISH_ONLY)
166 #ifdef LANG_NL
167  else if (L_EQUAL("dutch"))
168  {
169  theTranslator=new TranslatorDutch;
170  }
171 #endif
172 #ifdef LANG_AM
173  else if (L_EQUAL("armenian"))
174  {
175  theTranslator=new TranslatorArmenian;
176  }
177 #endif
178 #ifdef LANG_SV
179  else if (L_EQUAL("swedish"))
180  {
181  theTranslator=new TranslatorSwedish;
182  }
183 #endif
184 #ifdef LANG_CZ
185  else if (L_EQUAL("czech"))
186  {
187  theTranslator=new TranslatorCzech;
188  }
189 #endif
190 #ifdef LANG_FR
191  else if (L_EQUAL("french"))
192  {
193  theTranslator=new TranslatorFrench;
194  }
195 #endif
196 #ifdef LANG_ID
197  else if (L_EQUAL("indonesian"))
198  {
199  theTranslator=new TranslatorIndonesian;
200  }
201 #endif
202 #ifdef LANG_IT
203  else if (L_EQUAL("italian"))
204  {
205  theTranslator=new TranslatorItalian;
206  }
207 #endif
208 #ifdef LANG_DE
209  else if (L_EQUAL("german"))
210  {
211  theTranslator=new TranslatorGerman;
212  }
213 #endif
214 #ifdef LANG_JP
215  else if (L_EQUAL("japanese"))
216  {
217  theTranslator=new TranslatorJapanese;
218  }
219 #endif
220 #ifdef LANG_JE
221  else if (L_EQUAL("japanese-en"))
222  {
223  theTranslator=new TranslatorJapaneseEn;
224  }
225 #endif
226 #ifdef LANG_ES
227  else if (L_EQUAL("spanish"))
228  {
229  theTranslator=new TranslatorSpanish;
230  }
231 #endif
232 #ifdef LANG_FI
233  else if (L_EQUAL("finnish"))
234  {
235  theTranslator=new TranslatorFinnish;
236  }
237 #endif
238 #ifdef LANG_RU
239  else if (L_EQUAL("russian"))
240  {
241  theTranslator=new TranslatorRussian;
242  }
243 #endif
244 #ifdef LANG_HR
245  else if (L_EQUAL("croatian"))
246  {
247  theTranslator=new TranslatorCroatian;
248  }
249 #endif
250 #ifdef LANG_PL
251  else if (L_EQUAL("polish"))
252  {
253  theTranslator=new TranslatorPolish;
254  }
255 #endif
256 #ifdef LANG_PT
257  else if (L_EQUAL("portuguese"))
258  {
259  theTranslator=new TranslatorPortuguese;
260  }
261 #endif
262 #ifdef LANG_HU
263  else if (L_EQUAL("hungarian"))
264  {
265  theTranslator=new TranslatorHungarian;
266  }
267 #endif
268 #ifdef LANG_KR
269  else if (L_EQUAL("korean"))
270  {
271  theTranslator=new TranslatorKorean;
272  }
273 #endif
274 #ifdef LANG_KE
275  else if (L_EQUAL("korean-en"))
276  {
277  theTranslator=new TranslatorKoreanEn;
278  }
279 #endif
280 #ifdef LANG_RO
281  else if (L_EQUAL("romanian"))
282  {
283  theTranslator=new TranslatorRomanian;
284  }
285 #endif
286 #ifdef LANG_SI
287  else if (L_EQUAL("slovene"))
288  {
289  theTranslator=new TranslatorSlovene;
290  }
291 #endif
292 #ifdef LANG_CN
293  else if (L_EQUAL("chinese"))
294  {
295  theTranslator=new TranslatorChinese;
296  }
297 #endif
298 #ifdef LANG_TW
299  else if (L_EQUAL("chinese-traditional"))
300  {
301  theTranslator=new TranslatorChinesetraditional;
302  }
303 #endif
304 #ifdef LANG_NO
305  else if (L_EQUAL("norwegian"))
306  {
307  theTranslator=new TranslatorNorwegian;
308  }
309 #endif
310 #ifdef LANG_BR
311  else if (L_EQUAL("brazilian"))
312  {
313  theTranslator=new TranslatorBrazilian;
314  }
315 #endif
316 #ifdef LANG_DK
317  else if (L_EQUAL("danish"))
318  {
319  theTranslator=new TranslatorDanish;
320  }
321 #endif
322 #ifdef LANG_SK
323  else if (L_EQUAL("slovak"))
324  {
325  theTranslator=new TranslatorSlovak;
326  }
327 #endif
328 #ifdef LANG_UA
329  else if (L_EQUAL("ukrainian"))
330  {
331  theTranslator=new TranslatorUkrainian;
332  }
333 #endif
334 #ifdef LANG_GR
335  else if (L_EQUAL("greek"))
336  {
337  theTranslator=new TranslatorGreek;
338  }
339 #endif
340 #ifdef LANG_SR
341  else if (L_EQUAL("serbian"))
342  {
343  theTranslator=new TranslatorSerbian;
344  }
345 #endif
346 #ifdef LANG_SC
347  else if (L_EQUAL("serbian-cyrillic") || L_EQUAL("serbiancyr")) /* serbiancyr for consistency with older versions */
348  {
349  theTranslator=new TranslatorSerbianCyrillic;
350  }
351 #endif
352 #ifdef LANG_CA
353  else if (L_EQUAL("catalan"))
354  {
355  theTranslator=new TranslatorCatalan;
356  }
357 #endif
358 #ifdef LANG_LT
359  else if (L_EQUAL("lithuanian"))
360  {
361  theTranslator=new TranslatorLithuanian;
362  }
363 #endif
364 #ifdef LANG_LV
365  else if (L_EQUAL("latvian"))
366  {
367  theTranslator=new TranslatorLatvian;
368  }
369 #endif
370 #ifdef LANG_ZA
371  else if (L_EQUAL("afrikaans"))
372  {
373  theTranslator=new TranslatorAfrikaans;
374  }
375 #endif
376 #ifdef LANG_AR
377  else if (L_EQUAL("arabic"))
378  {
379  theTranslator=new TranslatorArabic;
380  }
381 #endif
382 #ifdef LANG_FA
383  else if (L_EQUAL("persian") || L_EQUAL("farsi"))
384  {
385  theTranslator=new TranslatorPersian;
386  }
387 #endif
388 #ifdef LANG_MK
389  else if (L_EQUAL("macedonian"))
390  {
391  theTranslator=new TranslatorMacedonian;
392  }
393 #endif
394 #ifdef LANG_VI
395  else if (L_EQUAL("vietnamese"))
396  {
397  theTranslator=new TranslatorVietnamese;
398  }
399 #endif
400 #ifdef LANG_TR
401  else if (L_EQUAL("turkish"))
402  {
403  theTranslator=new TranslatorTurkish;
404  }
405 #endif
406 #ifdef LANG_EO
407  else if (L_EQUAL("esperanto"))
408  {
409  theTranslator=new TranslatorEsperanto;
410  }
411 #endif
412 #endif // ENGLISH_ONLY
413  else // use the default language (i.e. english)
414  {
415  theTranslator=new TranslatorEnglish;
416  return FALSE;
417  }
418 
419  QCString msg = theTranslator->updateNeededMessage();
420  if (!msg.isEmpty()) warn_uncond(msg);
421  return TRUE;
422 }
bool isEmpty() const
Definition: qcstring.h:189
void msg(const char *fmt,...)
Definition: message.cpp:107
const bool FALSE
Definition: qglobal.h:370
#define L_EQUAL(a)
Definition: language.cpp:155
virtual QCString updateNeededMessage()
Definition: translator.h:32
bool setTranslator(const char *langName)
Definition: language.cpp:159
A bunch of utility functions.
Danish translation.
Translator * theTranslator
Definition: language.cpp:157
const bool TRUE
Definition: qglobal.h:371
void warn_uncond(const char *fmt,...)
Definition: message.cpp:218