]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
dccce9ea | 2 | // Name: src/common/intl.cpp |
77ffb593 | 3 | // Purpose: Internationalization and localisation for wxWidgets |
c801d85f | 4 | // Author: Vadim Zeitlin |
849a28d0 VS |
5 | // Modified by: Michael N. Filippov <michael@idisys.iae.nsk.su> |
6 | // (2003/09/30 - PluralForms support) | |
c801d85f KB |
7 | // Created: 29/01/98 |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
65571936 | 10 | // Licence: wxWindows licence |
c801d85f KB |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | // ============================================================================ | |
1678ad78 | 14 | // declaration |
c801d85f KB |
15 | // ============================================================================ |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // headers | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
8bcf4c86 VS |
21 | #if defined(__BORLAND__) && !defined(__WXDEBUG__) |
22 | // There's a bug in Borland's compiler that breaks wxLocale with -O2, | |
23 | // so make sure that flag is not used for this file: | |
24 | #pragma option -O1 | |
25 | #endif | |
26 | ||
3c221c50 SN |
27 | #ifdef __EMX__ |
28 | // The following define is needed by Innotek's libc to | |
29 | // make the definition of struct localeconv available. | |
30 | #define __INTERNAL_DEFS | |
31 | #endif | |
32 | ||
c801d85f KB |
33 | // For compilers that support precompilation, includes "wx.h". |
34 | #include "wx/wxprec.h" | |
35 | ||
36 | #ifdef __BORLANDC__ | |
84c18814 | 37 | #pragma hdrstop |
c801d85f KB |
38 | #endif |
39 | ||
d427503c VZ |
40 | #if wxUSE_INTL |
41 | ||
ad9835c9 WS |
42 | #ifndef WX_PRECOMP |
43 | #include "wx/dynarray.h" | |
44 | #include "wx/string.h" | |
45 | #include "wx/intl.h" | |
46 | #include "wx/log.h" | |
47 | #include "wx/debug.h" | |
48 | #include "wx/utils.h" | |
49 | #endif // WX_PRECOMP | |
1c193821 JS |
50 | |
51 | #ifndef __WXWINCE__ | |
ad9835c9 | 52 | #include <locale.h> |
1c193821 JS |
53 | #endif |
54 | ||
ad9835c9 | 55 | // standard headers |
dccce9ea VZ |
56 | #include <ctype.h> |
57 | #include <stdlib.h> | |
2ec6905c VS |
58 | #ifdef HAVE_LANGINFO_H |
59 | #include <langinfo.h> | |
60 | #endif | |
7502ba29 | 61 | |
1c193821 JS |
62 | #ifdef __WIN32__ |
63 | #include "wx/msw/private.h" | |
64 | #elif defined(__UNIX_LIKE__) | |
65 | #include "wx/fontmap.h" // for CharsetToEncoding() | |
66 | #endif | |
67 | ||
c801d85f | 68 | #include "wx/file.h" |
58ad1bab | 69 | #include "wx/filename.h" |
dccce9ea | 70 | #include "wx/tokenzr.h" |
41780009 | 71 | #include "wx/module.h" |
030c0bea VS |
72 | #include "wx/fontmap.h" |
73 | #include "wx/encconv.h" | |
563d535e | 74 | #include "wx/hashmap.h" |
849a28d0 | 75 | #include "wx/ptr_scpd.h" |
4d931bcc MW |
76 | #include "wx/app.h" |
77 | #include "wx/apptrait.h" | |
f830b2b1 | 78 | #include "wx/stdpaths.h" |
dccce9ea | 79 | |
76a5e5d2 SC |
80 | #if defined(__WXMAC__) |
81 | #include "wx/mac/private.h" // includes mac headers | |
82 | #endif | |
83 | ||
84c18814 VZ |
84 | // ---------------------------------------------------------------------------- |
85 | // simple types | |
86 | // ---------------------------------------------------------------------------- | |
87 | ||
e939abfd | 88 | // this should *not* be wxChar, this type must have exactly 8 bits! |
563d535e VS |
89 | typedef wxUint8 size_t8; |
90 | typedef wxUint32 size_t32; | |
84c18814 | 91 | |
c801d85f KB |
92 | // ---------------------------------------------------------------------------- |
93 | // constants | |
94 | // ---------------------------------------------------------------------------- | |
95 | ||
96 | // magic number identifying the .mo format file | |
c86f1403 VZ |
97 | const size_t32 MSGCATALOG_MAGIC = 0x950412de; |
98 | const size_t32 MSGCATALOG_MAGIC_SW = 0xde120495; | |
c801d85f | 99 | |
ec37df57 VZ |
100 | // the constants describing the format of lang_LANG locale string |
101 | static const size_t LEN_LANG = 2; | |
102 | static const size_t LEN_SUBLANG = 2; | |
103 | static const size_t LEN_FULL = LEN_LANG + 1 + LEN_SUBLANG; // 1 for '_' | |
104 | ||
ca6a9a14 VZ |
105 | #define TRACE_I18N _T("i18n") |
106 | ||
c801d85f | 107 | // ---------------------------------------------------------------------------- |
1678ad78 | 108 | // global functions |
c801d85f KB |
109 | // ---------------------------------------------------------------------------- |
110 | ||
f6bcfd97 | 111 | #ifdef __WXDEBUG__ |
c801d85f | 112 | |
f6bcfd97 BP |
113 | // small class to suppress the translation erros until exit from current scope |
114 | class NoTransErr | |
115 | { | |
116 | public: | |
117 | NoTransErr() { ms_suppressCount++; } | |
118 | ~NoTransErr() { ms_suppressCount--; } | |
119 | ||
120 | static bool Suppress() { return ms_suppressCount > 0; } | |
121 | ||
122 | private: | |
123 | static size_t ms_suppressCount; | |
124 | }; | |
c801d85f | 125 | |
f6bcfd97 BP |
126 | size_t NoTransErr::ms_suppressCount = 0; |
127 | ||
128 | #else // !Debug | |
129 | ||
130 | class NoTransErr | |
131 | { | |
132 | public: | |
133 | NoTransErr() { } | |
134 | ~NoTransErr() { } | |
135 | }; | |
136 | ||
137 | #endif // Debug/!Debug | |
c801d85f | 138 | |
84c18814 | 139 | static wxLocale *wxSetLocale(wxLocale *pLocale); |
c801d85f | 140 | |
ec37df57 VZ |
141 | // helper functions of GetSystemLanguage() |
142 | #ifdef __UNIX__ | |
143 | ||
144 | // get just the language part | |
145 | static inline wxString ExtractLang(const wxString& langFull) | |
146 | { | |
147 | return langFull.Left(LEN_LANG); | |
148 | } | |
149 | ||
150 | // get everything else (including the leading '_') | |
151 | static inline wxString ExtractNotLang(const wxString& langFull) | |
152 | { | |
153 | return langFull.Mid(LEN_LANG); | |
154 | } | |
155 | ||
156 | #endif // __UNIX__ | |
157 | ||
563d535e | 158 | |
849a28d0 VS |
159 | // ---------------------------------------------------------------------------- |
160 | // Plural forms parser | |
161 | // ---------------------------------------------------------------------------- | |
162 | ||
b7b97e77 | 163 | /* |
849a28d0 VS |
164 | Simplified Grammar |
165 | ||
166 | Expression: | |
167 | LogicalOrExpression '?' Expression ':' Expression | |
168 | LogicalOrExpression | |
169 | ||
170 | LogicalOrExpression: | |
171 | LogicalAndExpression "||" LogicalOrExpression // to (a || b) || c | |
172 | LogicalAndExpression | |
173 | ||
174 | LogicalAndExpression: | |
175 | EqualityExpression "&&" LogicalAndExpression // to (a && b) && c | |
176 | EqualityExpression | |
177 | ||
178 | EqualityExpression: | |
179 | RelationalExpression "==" RelationalExperession | |
180 | RelationalExpression "!=" RelationalExperession | |
181 | RelationalExpression | |
182 | ||
183 | RelationalExpression: | |
184 | MultiplicativeExpression '>' MultiplicativeExpression | |
185 | MultiplicativeExpression '<' MultiplicativeExpression | |
186 | MultiplicativeExpression ">=" MultiplicativeExpression | |
187 | MultiplicativeExpression "<=" MultiplicativeExpression | |
188 | MultiplicativeExpression | |
b7b97e77 | 189 | |
849a28d0 VS |
190 | MultiplicativeExpression: |
191 | PmExpression '%' PmExpression | |
192 | PmExpression | |
193 | ||
194 | PmExpression: | |
195 | N | |
196 | Number | |
197 | '(' Expression ')' | |
198 | */ | |
199 | ||
200 | class wxPluralFormsToken | |
201 | { | |
202 | public: | |
203 | enum Type | |
204 | { | |
205 | T_ERROR, T_EOF, T_NUMBER, T_N, T_PLURAL, T_NPLURALS, T_EQUAL, T_ASSIGN, | |
206 | T_GREATER, T_GREATER_OR_EQUAL, T_LESS, T_LESS_OR_EQUAL, | |
207 | T_REMINDER, T_NOT_EQUAL, | |
208 | T_LOGICAL_AND, T_LOGICAL_OR, T_QUESTION, T_COLON, T_SEMICOLON, | |
209 | T_LEFT_BRACKET, T_RIGHT_BRACKET | |
210 | }; | |
211 | Type type() const { return m_type; } | |
212 | void setType(Type type) { m_type = type; } | |
213 | // for T_NUMBER only | |
214 | typedef int Number; | |
215 | Number number() const { return m_number; } | |
216 | void setNumber(Number num) { m_number = num; } | |
217 | private: | |
218 | Type m_type; | |
219 | Number m_number; | |
220 | }; | |
221 | ||
222 | ||
223 | class wxPluralFormsScanner | |
224 | { | |
225 | public: | |
226 | wxPluralFormsScanner(const char* s); | |
227 | const wxPluralFormsToken& token() const { return m_token; } | |
228 | bool nextToken(); // returns false if error | |
229 | private: | |
230 | const char* m_s; | |
231 | wxPluralFormsToken m_token; | |
232 | }; | |
233 | ||
234 | wxPluralFormsScanner::wxPluralFormsScanner(const char* s) : m_s(s) | |
235 | { | |
236 | nextToken(); | |
237 | } | |
238 | ||
239 | bool wxPluralFormsScanner::nextToken() | |
240 | { | |
241 | wxPluralFormsToken::Type type = wxPluralFormsToken::T_ERROR; | |
242 | while (isspace(*m_s)) | |
243 | { | |
244 | ++m_s; | |
245 | } | |
246 | if (*m_s == 0) | |
247 | { | |
248 | type = wxPluralFormsToken::T_EOF; | |
249 | } | |
250 | else if (isdigit(*m_s)) | |
251 | { | |
252 | wxPluralFormsToken::Number number = *m_s++ - '0'; | |
253 | while (isdigit(*m_s)) | |
254 | { | |
255 | number = number * 10 + (*m_s++ - '0'); | |
256 | } | |
257 | m_token.setNumber(number); | |
258 | type = wxPluralFormsToken::T_NUMBER; | |
259 | } | |
260 | else if (isalpha(*m_s)) | |
261 | { | |
262 | const char* begin = m_s++; | |
263 | while (isalnum(*m_s)) | |
264 | { | |
265 | ++m_s; | |
266 | } | |
267 | size_t size = m_s - begin; | |
268 | if (size == 1 && memcmp(begin, "n", size) == 0) | |
269 | { | |
270 | type = wxPluralFormsToken::T_N; | |
271 | } | |
272 | else if (size == 6 && memcmp(begin, "plural", size) == 0) | |
273 | { | |
274 | type = wxPluralFormsToken::T_PLURAL; | |
275 | } | |
276 | else if (size == 8 && memcmp(begin, "nplurals", size) == 0) | |
277 | { | |
278 | type = wxPluralFormsToken::T_NPLURALS; | |
279 | } | |
280 | } | |
281 | else if (*m_s == '=') | |
282 | { | |
283 | ++m_s; | |
284 | if (*m_s == '=') | |
285 | { | |
286 | ++m_s; | |
287 | type = wxPluralFormsToken::T_EQUAL; | |
288 | } | |
289 | else | |
290 | { | |
291 | type = wxPluralFormsToken::T_ASSIGN; | |
292 | } | |
293 | } | |
294 | else if (*m_s == '>') | |
295 | { | |
296 | ++m_s; | |
297 | if (*m_s == '=') | |
298 | { | |
299 | ++m_s; | |
300 | type = wxPluralFormsToken::T_GREATER_OR_EQUAL; | |
301 | } | |
302 | else | |
303 | { | |
304 | type = wxPluralFormsToken::T_GREATER; | |
305 | } | |
306 | } | |
307 | else if (*m_s == '<') | |
308 | { | |
309 | ++m_s; | |
310 | if (*m_s == '=') | |
311 | { | |
312 | ++m_s; | |
313 | type = wxPluralFormsToken::T_LESS_OR_EQUAL; | |
314 | } | |
315 | else | |
316 | { | |
317 | type = wxPluralFormsToken::T_LESS; | |
318 | } | |
319 | } | |
320 | else if (*m_s == '%') | |
321 | { | |
322 | ++m_s; | |
323 | type = wxPluralFormsToken::T_REMINDER; | |
324 | } | |
325 | else if (*m_s == '!' && m_s[1] == '=') | |
326 | { | |
327 | m_s += 2; | |
328 | type = wxPluralFormsToken::T_NOT_EQUAL; | |
329 | } | |
330 | else if (*m_s == '&' && m_s[1] == '&') | |
331 | { | |
332 | m_s += 2; | |
333 | type = wxPluralFormsToken::T_LOGICAL_AND; | |
334 | } | |
335 | else if (*m_s == '|' && m_s[1] == '|') | |
336 | { | |
337 | m_s += 2; | |
338 | type = wxPluralFormsToken::T_LOGICAL_OR; | |
339 | } | |
340 | else if (*m_s == '?') | |
341 | { | |
342 | ++m_s; | |
343 | type = wxPluralFormsToken::T_QUESTION; | |
344 | } | |
345 | else if (*m_s == ':') | |
346 | { | |
347 | ++m_s; | |
348 | type = wxPluralFormsToken::T_COLON; | |
349 | } else if (*m_s == ';') { | |
350 | ++m_s; | |
351 | type = wxPluralFormsToken::T_SEMICOLON; | |
352 | } | |
353 | else if (*m_s == '(') | |
354 | { | |
355 | ++m_s; | |
356 | type = wxPluralFormsToken::T_LEFT_BRACKET; | |
357 | } | |
358 | else if (*m_s == ')') | |
359 | { | |
360 | ++m_s; | |
361 | type = wxPluralFormsToken::T_RIGHT_BRACKET; | |
362 | } | |
363 | m_token.setType(type); | |
364 | return type != wxPluralFormsToken::T_ERROR; | |
365 | } | |
366 | ||
367 | class wxPluralFormsNode; | |
368 | ||
369 | // NB: Can't use wxDEFINE_SCOPED_PTR_TYPE because wxPluralFormsNode is not | |
370 | // fully defined yet: | |
371 | class wxPluralFormsNodePtr | |
372 | { | |
373 | public: | |
374 | wxPluralFormsNodePtr(wxPluralFormsNode *p = NULL) : m_p(p) {} | |
375 | ~wxPluralFormsNodePtr(); | |
376 | wxPluralFormsNode& operator*() const { return *m_p; } | |
377 | wxPluralFormsNode* operator->() const { return m_p; } | |
378 | wxPluralFormsNode* get() const { return m_p; } | |
379 | wxPluralFormsNode* release(); | |
380 | void reset(wxPluralFormsNode *p); | |
381 | ||
382 | private: | |
383 | wxPluralFormsNode *m_p; | |
384 | }; | |
385 | ||
386 | class wxPluralFormsNode | |
387 | { | |
388 | public: | |
389 | wxPluralFormsNode(const wxPluralFormsToken& token) : m_token(token) {} | |
390 | const wxPluralFormsToken& token() const { return m_token; } | |
391 | const wxPluralFormsNode* node(size_t i) const | |
392 | { return m_nodes[i].get(); } | |
393 | void setNode(size_t i, wxPluralFormsNode* n); | |
394 | wxPluralFormsNode* releaseNode(size_t i); | |
395 | wxPluralFormsToken::Number evaluate(wxPluralFormsToken::Number n) const; | |
396 | ||
397 | private: | |
398 | wxPluralFormsToken m_token; | |
399 | wxPluralFormsNodePtr m_nodes[3]; | |
400 | }; | |
b7b97e77 | 401 | |
849a28d0 VS |
402 | wxPluralFormsNodePtr::~wxPluralFormsNodePtr() |
403 | { | |
404 | delete m_p; | |
405 | } | |
406 | wxPluralFormsNode* wxPluralFormsNodePtr::release() | |
407 | { | |
408 | wxPluralFormsNode *p = m_p; | |
409 | m_p = NULL; | |
410 | return p; | |
411 | } | |
412 | void wxPluralFormsNodePtr::reset(wxPluralFormsNode *p) | |
413 | { | |
414 | if (p != m_p) | |
415 | { | |
416 | delete m_p; | |
417 | m_p = p; | |
418 | } | |
419 | } | |
420 | ||
421 | ||
422 | void wxPluralFormsNode::setNode(size_t i, wxPluralFormsNode* n) | |
423 | { | |
424 | m_nodes[i].reset(n); | |
425 | } | |
426 | ||
427 | wxPluralFormsNode* wxPluralFormsNode::releaseNode(size_t i) | |
428 | { | |
429 | return m_nodes[i].release(); | |
430 | } | |
431 | ||
432 | wxPluralFormsToken::Number | |
433 | wxPluralFormsNode::evaluate(wxPluralFormsToken::Number n) const | |
434 | { | |
435 | switch (token().type()) | |
436 | { | |
437 | // leaf | |
438 | case wxPluralFormsToken::T_NUMBER: | |
439 | return token().number(); | |
440 | case wxPluralFormsToken::T_N: | |
441 | return n; | |
442 | // 2 args | |
443 | case wxPluralFormsToken::T_EQUAL: | |
444 | return node(0)->evaluate(n) == node(1)->evaluate(n); | |
445 | case wxPluralFormsToken::T_NOT_EQUAL: | |
446 | return node(0)->evaluate(n) != node(1)->evaluate(n); | |
447 | case wxPluralFormsToken::T_GREATER: | |
448 | return node(0)->evaluate(n) > node(1)->evaluate(n); | |
449 | case wxPluralFormsToken::T_GREATER_OR_EQUAL: | |
450 | return node(0)->evaluate(n) >= node(1)->evaluate(n); | |
451 | case wxPluralFormsToken::T_LESS: | |
452 | return node(0)->evaluate(n) < node(1)->evaluate(n); | |
453 | case wxPluralFormsToken::T_LESS_OR_EQUAL: | |
454 | return node(0)->evaluate(n) <= node(1)->evaluate(n); | |
455 | case wxPluralFormsToken::T_REMINDER: | |
456 | { | |
457 | wxPluralFormsToken::Number number = node(1)->evaluate(n); | |
458 | if (number != 0) | |
459 | { | |
460 | return node(0)->evaluate(n) % number; | |
461 | } | |
462 | else | |
463 | { | |
464 | return 0; | |
465 | } | |
466 | } | |
467 | case wxPluralFormsToken::T_LOGICAL_AND: | |
468 | return node(0)->evaluate(n) && node(1)->evaluate(n); | |
469 | case wxPluralFormsToken::T_LOGICAL_OR: | |
470 | return node(0)->evaluate(n) || node(1)->evaluate(n); | |
471 | // 3 args | |
472 | case wxPluralFormsToken::T_QUESTION: | |
473 | return node(0)->evaluate(n) | |
474 | ? node(1)->evaluate(n) | |
475 | : node(2)->evaluate(n); | |
476 | default: | |
477 | return 0; | |
478 | } | |
479 | } | |
480 | ||
481 | ||
482 | class wxPluralFormsCalculator | |
483 | { | |
484 | public: | |
485 | wxPluralFormsCalculator() : m_nplurals(0), m_plural(0) {} | |
b7b97e77 | 486 | |
849a28d0 VS |
487 | // input: number, returns msgstr index |
488 | int evaluate(int n) const; | |
489 | ||
490 | // input: text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"), | |
491 | // if s == 0, creates default handler | |
492 | // returns 0 if error | |
493 | static wxPluralFormsCalculator* make(const char* s = 0); | |
494 | ||
495 | ~wxPluralFormsCalculator() {} | |
496 | ||
497 | void init(wxPluralFormsToken::Number nplurals, wxPluralFormsNode* plural); | |
b7b97e77 | 498 | |
849a28d0 VS |
499 | private: |
500 | wxPluralFormsToken::Number m_nplurals; | |
501 | wxPluralFormsNodePtr m_plural; | |
502 | }; | |
503 | ||
4115960d | 504 | wxDEFINE_SCOPED_PTR_TYPE(wxPluralFormsCalculator) |
849a28d0 VS |
505 | |
506 | void wxPluralFormsCalculator::init(wxPluralFormsToken::Number nplurals, | |
507 | wxPluralFormsNode* plural) | |
508 | { | |
509 | m_nplurals = nplurals; | |
510 | m_plural.reset(plural); | |
511 | } | |
512 | ||
513 | int wxPluralFormsCalculator::evaluate(int n) const | |
514 | { | |
515 | if (m_plural.get() == 0) | |
516 | { | |
517 | return 0; | |
518 | } | |
519 | wxPluralFormsToken::Number number = m_plural->evaluate(n); | |
520 | if (number < 0 || number > m_nplurals) | |
521 | { | |
522 | return 0; | |
523 | } | |
524 | return number; | |
525 | } | |
526 | ||
527 | ||
528 | class wxPluralFormsParser | |
529 | { | |
530 | public: | |
531 | wxPluralFormsParser(wxPluralFormsScanner& scanner) : m_scanner(scanner) {} | |
532 | bool parse(wxPluralFormsCalculator& rCalculator); | |
533 | ||
534 | private: | |
535 | wxPluralFormsNode* parsePlural(); | |
536 | // stops at T_SEMICOLON, returns 0 if error | |
537 | wxPluralFormsScanner& m_scanner; | |
538 | const wxPluralFormsToken& token() const; | |
539 | bool nextToken(); | |
b7b97e77 | 540 | |
849a28d0 VS |
541 | wxPluralFormsNode* expression(); |
542 | wxPluralFormsNode* logicalOrExpression(); | |
543 | wxPluralFormsNode* logicalAndExpression(); | |
544 | wxPluralFormsNode* equalityExpression(); | |
545 | wxPluralFormsNode* multiplicativeExpression(); | |
546 | wxPluralFormsNode* relationalExpression(); | |
547 | wxPluralFormsNode* pmExpression(); | |
548 | }; | |
549 | ||
550 | bool wxPluralFormsParser::parse(wxPluralFormsCalculator& rCalculator) | |
551 | { | |
552 | if (token().type() != wxPluralFormsToken::T_NPLURALS) | |
553 | return false; | |
554 | if (!nextToken()) | |
555 | return false; | |
556 | if (token().type() != wxPluralFormsToken::T_ASSIGN) | |
557 | return false; | |
558 | if (!nextToken()) | |
559 | return false; | |
560 | if (token().type() != wxPluralFormsToken::T_NUMBER) | |
561 | return false; | |
562 | wxPluralFormsToken::Number nplurals = token().number(); | |
563 | if (!nextToken()) | |
564 | return false; | |
565 | if (token().type() != wxPluralFormsToken::T_SEMICOLON) | |
566 | return false; | |
567 | if (!nextToken()) | |
568 | return false; | |
569 | if (token().type() != wxPluralFormsToken::T_PLURAL) | |
570 | return false; | |
571 | if (!nextToken()) | |
572 | return false; | |
573 | if (token().type() != wxPluralFormsToken::T_ASSIGN) | |
574 | return false; | |
575 | if (!nextToken()) | |
576 | return false; | |
577 | wxPluralFormsNode* plural = parsePlural(); | |
578 | if (plural == 0) | |
579 | return false; | |
580 | if (token().type() != wxPluralFormsToken::T_SEMICOLON) | |
581 | return false; | |
582 | if (!nextToken()) | |
583 | return false; | |
584 | if (token().type() != wxPluralFormsToken::T_EOF) | |
585 | return false; | |
586 | rCalculator.init(nplurals, plural); | |
587 | return true; | |
588 | } | |
589 | ||
590 | wxPluralFormsNode* wxPluralFormsParser::parsePlural() | |
591 | { | |
592 | wxPluralFormsNode* p = expression(); | |
593 | if (p == NULL) | |
594 | { | |
595 | return NULL; | |
596 | } | |
597 | wxPluralFormsNodePtr n(p); | |
598 | if (token().type() != wxPluralFormsToken::T_SEMICOLON) | |
599 | { | |
600 | return NULL; | |
601 | } | |
602 | return n.release(); | |
603 | } | |
604 | ||
605 | const wxPluralFormsToken& wxPluralFormsParser::token() const | |
606 | { | |
607 | return m_scanner.token(); | |
608 | } | |
609 | ||
610 | bool wxPluralFormsParser::nextToken() | |
611 | { | |
612 | if (!m_scanner.nextToken()) | |
613 | return false; | |
614 | return true; | |
615 | } | |
616 | ||
617 | wxPluralFormsNode* wxPluralFormsParser::expression() | |
618 | { | |
619 | wxPluralFormsNode* p = logicalOrExpression(); | |
620 | if (p == NULL) | |
621 | return NULL; | |
622 | wxPluralFormsNodePtr n(p); | |
623 | if (token().type() == wxPluralFormsToken::T_QUESTION) | |
624 | { | |
625 | wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); | |
626 | if (!nextToken()) | |
627 | { | |
628 | return 0; | |
629 | } | |
630 | p = expression(); | |
631 | if (p == 0) | |
632 | { | |
633 | return 0; | |
634 | } | |
635 | qn->setNode(1, p); | |
636 | if (token().type() != wxPluralFormsToken::T_COLON) | |
637 | { | |
638 | return 0; | |
639 | } | |
640 | if (!nextToken()) | |
641 | { | |
642 | return 0; | |
643 | } | |
644 | p = expression(); | |
645 | if (p == 0) | |
646 | { | |
647 | return 0; | |
648 | } | |
649 | qn->setNode(2, p); | |
650 | qn->setNode(0, n.release()); | |
651 | return qn.release(); | |
652 | } | |
653 | return n.release(); | |
654 | } | |
655 | ||
656 | wxPluralFormsNode*wxPluralFormsParser::logicalOrExpression() | |
657 | { | |
658 | wxPluralFormsNode* p = logicalAndExpression(); | |
659 | if (p == NULL) | |
660 | return NULL; | |
661 | wxPluralFormsNodePtr ln(p); | |
662 | if (token().type() == wxPluralFormsToken::T_LOGICAL_OR) | |
663 | { | |
664 | wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); | |
665 | if (!nextToken()) | |
666 | { | |
667 | return 0; | |
668 | } | |
669 | p = logicalOrExpression(); | |
670 | if (p == 0) | |
671 | { | |
672 | return 0; | |
673 | } | |
674 | wxPluralFormsNodePtr rn(p); // right | |
675 | if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_OR) | |
676 | { | |
677 | // see logicalAndExpression comment | |
678 | un->setNode(0, ln.release()); | |
679 | un->setNode(1, rn->releaseNode(0)); | |
680 | rn->setNode(0, un.release()); | |
681 | return rn.release(); | |
682 | } | |
a509f830 VZ |
683 | |
684 | ||
685 | un->setNode(0, ln.release()); | |
686 | un->setNode(1, rn.release()); | |
687 | return un.release(); | |
849a28d0 VS |
688 | } |
689 | return ln.release(); | |
690 | } | |
691 | ||
692 | wxPluralFormsNode* wxPluralFormsParser::logicalAndExpression() | |
693 | { | |
694 | wxPluralFormsNode* p = equalityExpression(); | |
695 | if (p == NULL) | |
696 | return NULL; | |
697 | wxPluralFormsNodePtr ln(p); // left | |
698 | if (token().type() == wxPluralFormsToken::T_LOGICAL_AND) | |
699 | { | |
700 | wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); // up | |
701 | if (!nextToken()) | |
702 | { | |
703 | return NULL; | |
704 | } | |
705 | p = logicalAndExpression(); | |
706 | if (p == 0) | |
707 | { | |
708 | return NULL; | |
709 | } | |
710 | wxPluralFormsNodePtr rn(p); // right | |
711 | if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_AND) | |
712 | { | |
713 | // transform 1 && (2 && 3) -> (1 && 2) && 3 | |
714 | // u r | |
715 | // l r -> u 3 | |
716 | // 2 3 l 2 | |
717 | un->setNode(0, ln.release()); | |
718 | un->setNode(1, rn->releaseNode(0)); | |
719 | rn->setNode(0, un.release()); | |
720 | return rn.release(); | |
721 | } | |
a509f830 VZ |
722 | |
723 | un->setNode(0, ln.release()); | |
724 | un->setNode(1, rn.release()); | |
725 | return un.release(); | |
849a28d0 VS |
726 | } |
727 | return ln.release(); | |
728 | } | |
729 | ||
730 | wxPluralFormsNode* wxPluralFormsParser::equalityExpression() | |
731 | { | |
732 | wxPluralFormsNode* p = relationalExpression(); | |
733 | if (p == NULL) | |
734 | return NULL; | |
735 | wxPluralFormsNodePtr n(p); | |
736 | if (token().type() == wxPluralFormsToken::T_EQUAL | |
737 | || token().type() == wxPluralFormsToken::T_NOT_EQUAL) | |
738 | { | |
739 | wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); | |
740 | if (!nextToken()) | |
741 | { | |
742 | return NULL; | |
743 | } | |
744 | p = relationalExpression(); | |
745 | if (p == NULL) | |
746 | { | |
747 | return NULL; | |
748 | } | |
749 | qn->setNode(1, p); | |
750 | qn->setNode(0, n.release()); | |
751 | return qn.release(); | |
752 | } | |
753 | return n.release(); | |
754 | } | |
755 | ||
756 | wxPluralFormsNode* wxPluralFormsParser::relationalExpression() | |
757 | { | |
758 | wxPluralFormsNode* p = multiplicativeExpression(); | |
759 | if (p == NULL) | |
760 | return NULL; | |
761 | wxPluralFormsNodePtr n(p); | |
762 | if (token().type() == wxPluralFormsToken::T_GREATER | |
763 | || token().type() == wxPluralFormsToken::T_LESS | |
764 | || token().type() == wxPluralFormsToken::T_GREATER_OR_EQUAL | |
765 | || token().type() == wxPluralFormsToken::T_LESS_OR_EQUAL) | |
766 | { | |
767 | wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); | |
768 | if (!nextToken()) | |
769 | { | |
770 | return NULL; | |
771 | } | |
772 | p = multiplicativeExpression(); | |
773 | if (p == NULL) | |
774 | { | |
775 | return NULL; | |
776 | } | |
777 | qn->setNode(1, p); | |
778 | qn->setNode(0, n.release()); | |
779 | return qn.release(); | |
780 | } | |
781 | return n.release(); | |
782 | } | |
783 | ||
784 | wxPluralFormsNode* wxPluralFormsParser::multiplicativeExpression() | |
785 | { | |
786 | wxPluralFormsNode* p = pmExpression(); | |
787 | if (p == NULL) | |
788 | return NULL; | |
789 | wxPluralFormsNodePtr n(p); | |
790 | if (token().type() == wxPluralFormsToken::T_REMINDER) | |
791 | { | |
792 | wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); | |
793 | if (!nextToken()) | |
794 | { | |
795 | return NULL; | |
796 | } | |
797 | p = pmExpression(); | |
798 | if (p == NULL) | |
799 | { | |
800 | return NULL; | |
801 | } | |
802 | qn->setNode(1, p); | |
803 | qn->setNode(0, n.release()); | |
804 | return qn.release(); | |
805 | } | |
806 | return n.release(); | |
807 | } | |
808 | ||
809 | wxPluralFormsNode* wxPluralFormsParser::pmExpression() | |
810 | { | |
811 | wxPluralFormsNodePtr n; | |
812 | if (token().type() == wxPluralFormsToken::T_N | |
813 | || token().type() == wxPluralFormsToken::T_NUMBER) | |
814 | { | |
815 | n.reset(new wxPluralFormsNode(token())); | |
816 | if (!nextToken()) | |
817 | { | |
818 | return NULL; | |
819 | } | |
820 | } | |
821 | else if (token().type() == wxPluralFormsToken::T_LEFT_BRACKET) { | |
822 | if (!nextToken()) | |
823 | { | |
824 | return NULL; | |
825 | } | |
826 | wxPluralFormsNode* p = expression(); | |
827 | if (p == NULL) | |
828 | { | |
829 | return NULL; | |
830 | } | |
831 | n.reset(p); | |
832 | if (token().type() != wxPluralFormsToken::T_RIGHT_BRACKET) | |
833 | { | |
834 | return NULL; | |
835 | } | |
836 | if (!nextToken()) | |
837 | { | |
838 | return NULL; | |
839 | } | |
840 | } | |
841 | else | |
842 | { | |
843 | return NULL; | |
844 | } | |
845 | return n.release(); | |
846 | } | |
847 | ||
848 | wxPluralFormsCalculator* wxPluralFormsCalculator::make(const char* s) | |
849 | { | |
850 | wxPluralFormsCalculatorPtr calculator(new wxPluralFormsCalculator); | |
851 | if (s != NULL) | |
852 | { | |
853 | wxPluralFormsScanner scanner(s); | |
854 | wxPluralFormsParser p(scanner); | |
855 | if (!p.parse(*calculator)) | |
856 | { | |
857 | return NULL; | |
858 | } | |
859 | } | |
860 | return calculator.release(); | |
861 | } | |
862 | ||
863 | ||
864 | ||
41524ffc | 865 | |
563d535e VS |
866 | // ---------------------------------------------------------------------------- |
867 | // wxMsgCatalogFile corresponds to one disk-file message catalog. | |
868 | // | |
869 | // This is a "low-level" class and is used only by wxMsgCatalog | |
870 | // ---------------------------------------------------------------------------- | |
871 | ||
3f5c62f9 | 872 | WX_DECLARE_EXPORTED_STRING_HASH_MAP(wxString, wxMessagesHash); |
563d535e VS |
873 | |
874 | class wxMsgCatalogFile | |
875 | { | |
876 | public: | |
877 | // ctor & dtor | |
878 | wxMsgCatalogFile(); | |
879 | ~wxMsgCatalogFile(); | |
880 | ||
881 | // load the catalog from disk (szDirPrefix corresponds to language) | |
849a28d0 VS |
882 | bool Load(const wxChar *szDirPrefix, const wxChar *szName, |
883 | wxPluralFormsCalculatorPtr& rPluralFormsCalculator); | |
563d535e VS |
884 | |
885 | // fills the hash with string-translation pairs | |
77c514d1 VZ |
886 | void FillHash(wxMessagesHash& hash, |
887 | const wxString& msgIdCharset, | |
d721baa9 | 888 | bool convertEncoding) const; |
563d535e | 889 | |
77c514d1 VZ |
890 | // return the charset of the strings in this catalog or empty string if |
891 | // none/unknown | |
892 | wxString GetCharset() const { return m_charset; } | |
893 | ||
563d535e VS |
894 | private: |
895 | // this implementation is binary compatible with GNU gettext() version 0.10 | |
896 | ||
897 | // an entry in the string table | |
898 | struct wxMsgTableEntry | |
899 | { | |
900 | size_t32 nLen; // length of the string | |
901 | size_t32 ofsString; // pointer to the string | |
902 | }; | |
903 | ||
904 | // header of a .mo file | |
905 | struct wxMsgCatalogHeader | |
906 | { | |
907 | size_t32 magic, // offset +00: magic id | |
908 | revision, // +04: revision | |
909 | numStrings; // +08: number of strings in the file | |
910 | size_t32 ofsOrigTable, // +0C: start of original string table | |
911 | ofsTransTable; // +10: start of translated string table | |
912 | size_t32 nHashSize, // +14: hash table size | |
913 | ofsHashTable; // +18: offset of hash table start | |
914 | }; | |
915 | ||
916 | // all data is stored here, NULL if no data loaded | |
917 | size_t8 *m_pData; | |
918 | ||
869c7549 VZ |
919 | // amount of memory pointed to by m_pData. |
920 | size_t32 m_nSize; | |
921 | ||
563d535e VS |
922 | // data description |
923 | size_t32 m_numStrings; // number of strings in this domain | |
924 | wxMsgTableEntry *m_pOrigTable, // pointer to original strings | |
925 | *m_pTransTable; // translated | |
926 | ||
77c514d1 VZ |
927 | wxString m_charset; // from the message catalog header |
928 | ||
b7b97e77 | 929 | |
869c7549 VZ |
930 | // swap the 2 halves of 32 bit integer if needed |
931 | size_t32 Swap(size_t32 ui) const | |
932 | { | |
933 | return m_bSwapped ? (ui << 24) | ((ui & 0xff00) << 8) | | |
934 | ((ui >> 8) & 0xff00) | (ui >> 24) | |
935 | : ui; | |
936 | } | |
9e7ed2b0 | 937 | |
869c7549 VZ |
938 | const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 n) const |
939 | { | |
940 | const wxMsgTableEntry * const ent = pTable + n; | |
563d535e | 941 | |
869c7549 VZ |
942 | // this check could fail for a corrupt message catalog |
943 | size_t32 ofsString = Swap(ent->ofsString); | |
944 | if ( ofsString + Swap(ent->nLen) > m_nSize) | |
849a28d0 | 945 | { |
869c7549 | 946 | return NULL; |
849a28d0 | 947 | } |
563d535e | 948 | |
869c7549 | 949 | return (const char *)(m_pData + ofsString); |
b7b97e77 | 950 | } |
869c7549 VZ |
951 | |
952 | bool m_bSwapped; // wrong endianness? | |
22f3361e VZ |
953 | |
954 | DECLARE_NO_COPY_CLASS(wxMsgCatalogFile) | |
563d535e VS |
955 | }; |
956 | ||
957 | ||
c801d85f | 958 | // ---------------------------------------------------------------------------- |
563d535e | 959 | // wxMsgCatalog corresponds to one loaded message catalog. |
c801d85f KB |
960 | // |
961 | // This is a "low-level" class and is used only by wxLocale (that's why | |
962 | // it's designed to be stored in a linked list) | |
963 | // ---------------------------------------------------------------------------- | |
964 | ||
965 | class wxMsgCatalog | |
966 | { | |
967 | public: | |
77c514d1 VZ |
968 | wxMsgCatalog() { m_conv = NULL; } |
969 | ~wxMsgCatalog(); | |
970 | ||
563d535e | 971 | // load the catalog from disk (szDirPrefix corresponds to language) |
d721baa9 VS |
972 | bool Load(const wxChar *szDirPrefix, const wxChar *szName, |
973 | const wxChar *msgIdCharset = NULL, bool bConvertEncoding = false); | |
c801d85f | 974 | |
563d535e VS |
975 | // get name of the catalog |
976 | wxString GetName() const { return m_name; } | |
c801d85f | 977 | |
563d535e | 978 | // get the translated string: returns NULL if not found |
849a28d0 | 979 | const wxChar *GetString(const wxChar *sz, size_t n = size_t(-1)) const; |
c801d85f | 980 | |
563d535e VS |
981 | // public variable pointing to the next element in a linked list (or NULL) |
982 | wxMsgCatalog *m_pNext; | |
7af89395 | 983 | |
c801d85f | 984 | private: |
563d535e VS |
985 | wxMessagesHash m_messages; // all messages in the catalog |
986 | wxString m_name; // name of the domain | |
77c514d1 VZ |
987 | |
988 | // the conversion corresponding to this catalog charset if we installed it | |
989 | // as the global one | |
990 | wxCSConv *m_conv; | |
991 | ||
849a28d0 | 992 | wxPluralFormsCalculatorPtr m_pluralFormsCalculator; |
c801d85f KB |
993 | }; |
994 | ||
fd323a5e VZ |
995 | // ---------------------------------------------------------------------------- |
996 | // global variables | |
997 | // ---------------------------------------------------------------------------- | |
998 | ||
999 | // the list of the directories to search for message catalog files | |
f830b2b1 | 1000 | static wxArrayString gs_searchPrefixes; |
fd323a5e | 1001 | |
c801d85f KB |
1002 | // ============================================================================ |
1003 | // implementation | |
1004 | // ============================================================================ | |
1005 | ||
1006 | // ---------------------------------------------------------------------------- | |
563d535e | 1007 | // wxMsgCatalogFile class |
c801d85f KB |
1008 | // ---------------------------------------------------------------------------- |
1009 | ||
563d535e | 1010 | wxMsgCatalogFile::wxMsgCatalogFile() |
7af89395 | 1011 | { |
869c7549 VZ |
1012 | m_pData = NULL; |
1013 | m_nSize = 0; | |
c801d85f KB |
1014 | } |
1015 | ||
563d535e | 1016 | wxMsgCatalogFile::~wxMsgCatalogFile() |
7af89395 | 1017 | { |
77c514d1 | 1018 | delete [] m_pData; |
c801d85f KB |
1019 | } |
1020 | ||
f830b2b1 VZ |
1021 | // return the directory to search for message catalogs under the given prefix |
1022 | static | |
1023 | wxString GetMsgCatalogSubdir(const wxChar *prefix, const wxChar *lang) | |
fd323a5e VZ |
1024 | { |
1025 | wxString searchPath; | |
f830b2b1 | 1026 | searchPath << prefix << wxFILE_SEP_PATH << lang; |
fd323a5e | 1027 | |
f830b2b1 | 1028 | // under Unix, the message catalogs are supposed to go into LC_MESSAGES |
f0a6989d | 1029 | // subdirectory so look there too |
f830b2b1 | 1030 | #ifdef __UNIX__ |
f0a6989d VZ |
1031 | const wxString searchPathOrig(searchPath); |
1032 | searchPath << wxFILE_SEP_PATH << wxT("LC_MESSAGES") | |
1033 | << wxPATH_SEP << searchPathOrig; | |
1034 | #endif // __UNIX__ | |
fd323a5e VZ |
1035 | |
1036 | return searchPath; | |
1037 | } | |
1038 | ||
1039 | // construct the search path for the given language | |
e36e6f95 | 1040 | static wxString GetFullSearchPath(const wxChar *lang) |
fd323a5e | 1041 | { |
fd323a5e | 1042 | // first take the entries explicitly added by the program |
f830b2b1 VZ |
1043 | wxArrayString paths; |
1044 | paths.reserve(gs_searchPrefixes.size() + 1); | |
1045 | size_t n, | |
1046 | count = gs_searchPrefixes.size(); | |
1047 | for ( n = 0; n < count; n++ ) | |
fd323a5e | 1048 | { |
f830b2b1 | 1049 | paths.Add(GetMsgCatalogSubdir(gs_searchPrefixes[n], lang)); |
fd323a5e VZ |
1050 | } |
1051 | ||
30984dea | 1052 | |
f830b2b1 VZ |
1053 | #if wxUSE_STDPATHS |
1054 | // then look in the standard location | |
1055 | const wxString stdp = wxStandardPaths::Get(). | |
1056 | GetLocalizedResourcesDir(lang, wxStandardPaths::ResourceCat_Messages); | |
1057 | ||
1058 | if ( paths.Index(stdp) == wxNOT_FOUND ) | |
1059 | paths.Add(stdp); | |
1060 | #endif // wxUSE_STDPATHS | |
1061 | ||
1062 | // last look in default locations | |
1063 | #ifdef __UNIX__ | |
5f170f33 VZ |
1064 | // LC_PATH is a standard env var containing the search path for the .mo |
1065 | // files | |
f6bcfd97 | 1066 | const wxChar *pszLcPath = wxGetenv(wxT("LC_PATH")); |
f830b2b1 VZ |
1067 | if ( pszLcPath ) |
1068 | { | |
1069 | const wxString lcp = GetMsgCatalogSubdir(pszLcPath, lang); | |
1070 | if ( paths.Index(lcp) == wxNOT_FOUND ) | |
1071 | paths.Add(lcp); | |
1072 | } | |
5f170f33 | 1073 | |
f830b2b1 VZ |
1074 | // also add the one from where wxWin was installed: |
1075 | wxString wxp = wxGetInstallPrefix(); | |
1076 | if ( !wxp.empty() ) | |
1077 | { | |
1078 | wxp = GetMsgCatalogSubdir(wxp + _T("/share/locale"), lang); | |
1079 | if ( paths.Index(wxp) == wxNOT_FOUND ) | |
1080 | paths.Add(wxp); | |
1081 | } | |
c3ccca4a VS |
1082 | #endif // __UNIX__ |
1083 | ||
f830b2b1 VZ |
1084 | |
1085 | // finally construct the full search path | |
1086 | wxString searchPath; | |
1087 | searchPath.reserve(500); | |
1088 | count = paths.size(); | |
1089 | for ( n = 0; n < count; n++ ) | |
1090 | { | |
1091 | searchPath += paths[n]; | |
1092 | if ( n != count - 1 ) | |
1093 | searchPath += wxPATH_SEP; | |
1094 | } | |
45e97ca0 | 1095 | |
fd323a5e VZ |
1096 | return searchPath; |
1097 | } | |
1098 | ||
c801d85f | 1099 | // open disk file and read in it's contents |
58ad1bab | 1100 | bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName, |
849a28d0 | 1101 | wxPluralFormsCalculatorPtr& rPluralFormsCalculator) |
c801d85f | 1102 | { |
ca6a9a14 VZ |
1103 | wxString searchPath; |
1104 | ||
1105 | #if wxUSE_FONTMAP | |
1106 | // first look for the catalog for this language and the current locale: | |
1107 | // notice that we don't use the system name for the locale as this would | |
1108 | // force us to install catalogs in different locations depending on the | |
1109 | // system but always use the canonical name | |
1110 | wxFontEncoding encSys = wxLocale::GetSystemEncoding(); | |
1111 | if ( encSys != wxFONTENCODING_SYSTEM ) | |
1112 | { | |
1113 | wxString fullname(szDirPrefix); | |
1114 | fullname << _T('.') << wxFontMapperBase::GetEncodingName(encSys); | |
1115 | searchPath << GetFullSearchPath(fullname) << wxPATH_SEP; | |
1116 | } | |
1117 | #endif // wxUSE_FONTMAP | |
1118 | ||
2ce0a6e2 | 1119 | |
ca6a9a14 | 1120 | searchPath += GetFullSearchPath(szDirPrefix); |
223d09f6 | 1121 | const wxChar *sublocale = wxStrchr(szDirPrefix, wxT('_')); |
fd323a5e VZ |
1122 | if ( sublocale ) |
1123 | { | |
1124 | // also add just base locale name: for things like "fr_BE" (belgium | |
1125 | // french) we should use "fr" if no belgium specific message catalogs | |
1126 | // exist | |
f830b2b1 VZ |
1127 | searchPath << wxPATH_SEP |
1128 | << GetFullSearchPath(wxString(szDirPrefix). | |
1129 | Left((size_t)(sublocale - szDirPrefix))); | |
fd323a5e | 1130 | } |
7af89395 | 1131 | |
c801d85f KB |
1132 | // don't give translation errors here because the wxstd catalog might |
1133 | // not yet be loaded (and it's normal) | |
1134 | // | |
1135 | // (we're using an object because we have several return paths) | |
ed58dbea | 1136 | |
c801d85f | 1137 | NoTransErr noTransErr; |
5f170f33 | 1138 | wxLogVerbose(_("looking for catalog '%s' in path '%s'."), |
58ad1bab | 1139 | szName, searchPath.c_str()); |
ca6a9a14 VZ |
1140 | wxLogTrace(TRACE_I18N, _T("Looking for \"%s.mo\" in \"%s\""), |
1141 | szName, searchPath.c_str()); | |
c801d85f | 1142 | |
58ad1bab | 1143 | wxFileName fn(szName); |
de085fcc | 1144 | fn.SetExt(_T("mo")); |
c801d85f | 1145 | wxString strFullName; |
58ad1bab VZ |
1146 | if ( !wxFindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) { |
1147 | wxLogVerbose(_("catalog file for domain '%s' not found."), szName); | |
ca6a9a14 | 1148 | wxLogTrace(TRACE_I18N, _T("Catalog \"%s.mo\" not found"), szName); |
7beb59f3 | 1149 | return false; |
c801d85f KB |
1150 | } |
1151 | ||
1152 | // open file | |
58ad1bab | 1153 | wxLogVerbose(_("using catalog '%s' from '%s'."), szName, strFullName.c_str()); |
ca6a9a14 | 1154 | wxLogTrace(TRACE_I18N, _T("Using catalog \"%s\"."), strFullName.c_str()); |
7af89395 | 1155 | |
c801d85f KB |
1156 | wxFile fileMsg(strFullName); |
1157 | if ( !fileMsg.IsOpened() ) | |
7beb59f3 | 1158 | return false; |
c801d85f | 1159 | |
170b04ba | 1160 | // get the file size (assume it is less than 4Gb...) |
17a1ebd1 VZ |
1161 | wxFileOffset lenFile = fileMsg.Length(); |
1162 | if ( lenFile == wxInvalidOffset ) | |
7beb59f3 | 1163 | return false; |
c801d85f | 1164 | |
17a1ebd1 | 1165 | size_t nSize = wx_truncate_cast(size_t, lenFile); |
4a10ea8b | 1166 | wxASSERT_MSG( nSize == lenFile + size_t(0), _T("message catalog bigger than 4GB?") ); |
17a1ebd1 | 1167 | |
c801d85f | 1168 | // read the whole file in memory |
c86f1403 | 1169 | m_pData = new size_t8[nSize]; |
c88c6e94 | 1170 | if ( fileMsg.Read(m_pData, nSize) != lenFile ) { |
a3622daa | 1171 | wxDELETEA(m_pData); |
7beb59f3 | 1172 | return false; |
c801d85f | 1173 | } |
7af89395 | 1174 | |
c801d85f | 1175 | // examine header |
30984dea | 1176 | bool bValid = nSize + (size_t)0 > sizeof(wxMsgCatalogHeader); |
7af89395 | 1177 | |
fd3f686c | 1178 | wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData; |
c801d85f | 1179 | if ( bValid ) { |
c801d85f KB |
1180 | // we'll have to swap all the integers if it's true |
1181 | m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW; | |
1182 | ||
1183 | // check the magic number | |
1184 | bValid = m_bSwapped || pHeader->magic == MSGCATALOG_MAGIC; | |
1185 | } | |
7af89395 | 1186 | |
c801d85f KB |
1187 | if ( !bValid ) { |
1188 | // it's either too short or has incorrect magic number | |
1a5a8367 | 1189 | wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str()); |
7af89395 | 1190 | |
a3622daa | 1191 | wxDELETEA(m_pData); |
7beb59f3 | 1192 | return false; |
c801d85f | 1193 | } |
7af89395 | 1194 | |
c801d85f KB |
1195 | // initialize |
1196 | m_numStrings = Swap(pHeader->numStrings); | |
7af89395 | 1197 | m_pOrigTable = (wxMsgTableEntry *)(m_pData + |
1678ad78 | 1198 | Swap(pHeader->ofsOrigTable)); |
7af89395 | 1199 | m_pTransTable = (wxMsgTableEntry *)(m_pData + |
1678ad78 | 1200 | Swap(pHeader->ofsTransTable)); |
2e0ef2ae | 1201 | m_nSize = (size_t32)nSize; |
b7b97e77 | 1202 | |
849a28d0 VS |
1203 | // now parse catalog's header and try to extract catalog charset and |
1204 | // plural forms formula from it: | |
1205 | ||
1206 | const char* headerData = StringAtOfs(m_pOrigTable, 0); | |
1207 | if (headerData && headerData[0] == 0) | |
1208 | { | |
1209 | // Extract the charset: | |
1210 | wxString header = wxString::FromAscii(StringAtOfs(m_pTransTable, 0)); | |
1211 | int begin = header.Find(wxT("Content-Type: text/plain; charset=")); | |
1212 | if (begin != wxNOT_FOUND) | |
1213 | { | |
1214 | begin += 34; //strlen("Content-Type: text/plain; charset=") | |
1215 | size_t end = header.find('\n', begin); | |
1216 | if (end != size_t(-1)) | |
1217 | { | |
1218 | m_charset.assign(header, begin, end - begin); | |
1219 | if (m_charset == wxT("CHARSET")) | |
1220 | { | |
1221 | // "CHARSET" is not valid charset, but lazy translator | |
1222 | m_charset.Clear(); | |
1223 | } | |
1224 | } | |
1225 | } | |
1226 | // else: incorrectly filled Content-Type header | |
b7b97e77 | 1227 | |
849a28d0 VS |
1228 | // Extract plural forms: |
1229 | begin = header.Find(wxT("Plural-Forms:")); | |
1230 | if (begin != wxNOT_FOUND) | |
1231 | { | |
1232 | begin += 13; | |
1233 | size_t end = header.find('\n', begin); | |
1234 | if (end != size_t(-1)) | |
1235 | { | |
1236 | wxString pfs(header, begin, end - begin); | |
1237 | wxPluralFormsCalculator* pCalculator = wxPluralFormsCalculator | |
1238 | ::make(pfs.ToAscii()); | |
1239 | if (pCalculator != 0) | |
1240 | { | |
1241 | rPluralFormsCalculator.reset(pCalculator); | |
1242 | } | |
1243 | else | |
1244 | { | |
ca6a9a14 | 1245 | wxLogVerbose(_("Cannot parse Plural-Forms:'%s'"), pfs.c_str()); |
849a28d0 VS |
1246 | } |
1247 | } | |
1248 | } | |
1249 | if (rPluralFormsCalculator.get() == NULL) | |
1250 | { | |
1251 | rPluralFormsCalculator.reset(wxPluralFormsCalculator::make()); | |
1252 | } | |
1253 | } | |
c801d85f | 1254 | |
c801d85f | 1255 | // everything is fine |
849a28d0 | 1256 | return true; |
c801d85f KB |
1257 | } |
1258 | ||
d721baa9 VS |
1259 | void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, |
1260 | const wxString& msgIdCharset, | |
1261 | bool convertEncoding) const | |
c801d85f | 1262 | { |
7a4b1e66 VZ |
1263 | #if wxUSE_UNICODE |
1264 | // this parameter doesn't make sense, we always must convert encoding in | |
1265 | // Unicode build | |
1266 | convertEncoding = true; | |
1267 | #elif wxUSE_FONTMAP | |
7cb06872 VZ |
1268 | if ( convertEncoding ) |
1269 | { | |
77c514d1 | 1270 | // determine if we need any conversion at all |
7cb06872 VZ |
1271 | wxFontEncoding encCat = wxFontMapperBase::GetEncodingFromName(m_charset); |
1272 | if ( encCat == wxLocale::GetSystemEncoding() ) | |
1273 | { | |
1274 | // no need to convert | |
1275 | convertEncoding = false; | |
1276 | } | |
1277 | } | |
7a4b1e66 | 1278 | #endif // wxUSE_UNICODE/wxUSE_FONTMAP |
7cb06872 | 1279 | |
563d535e | 1280 | #if wxUSE_WCHAR_T |
35d10652 VZ |
1281 | // conversion to use to convert catalog strings to the GUI encoding |
1282 | wxMBConv *inputConv, | |
7a4b1e66 VZ |
1283 | *inputConvPtr = NULL; // same as inputConv but safely deleteable |
1284 | if ( convertEncoding && !m_charset.empty() ) | |
35d10652 | 1285 | { |
7a4b1e66 VZ |
1286 | inputConvPtr = |
1287 | inputConv = new wxCSConv(m_charset); | |
35d10652 | 1288 | } |
7a4b1e66 | 1289 | else // no need or not possible to convert the encoding |
35d10652 | 1290 | { |
f15fa3a9 | 1291 | #if wxUSE_UNICODE |
7a4b1e66 VZ |
1292 | // we must somehow convert the narrow strings in the message catalog to |
1293 | // wide strings, so use the default conversion if we have no charset | |
f15fa3a9 VZ |
1294 | inputConv = wxConvCurrent; |
1295 | #else // !wxUSE_UNICODE | |
35d10652 | 1296 | inputConv = NULL; |
f15fa3a9 | 1297 | #endif // wxUSE_UNICODE/!wxUSE_UNICODE |
35d10652 | 1298 | } |
d721baa9 | 1299 | |
35d10652 VZ |
1300 | // conversion to apply to msgid strings before looking them up: we only |
1301 | // need it if the msgids are neither in 7 bit ASCII nor in the same | |
1302 | // encoding as the catalog | |
1303 | wxCSConv *sourceConv = msgIdCharset.empty() || (msgIdCharset == m_charset) | |
1304 | ? NULL | |
1305 | : new wxCSConv(msgIdCharset); | |
d721baa9 | 1306 | |
849a28d0 | 1307 | #elif wxUSE_FONTMAP |
d721baa9 VS |
1308 | wxASSERT_MSG( msgIdCharset == NULL, |
1309 | _T("non-ASCII msgid languages only supported if wxUSE_WCHAR_T=1") ); | |
7beb59f3 | 1310 | |
849a28d0 | 1311 | wxEncodingConverter converter; |
563d535e VS |
1312 | if ( convertEncoding ) |
1313 | { | |
baf736e1 | 1314 | wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM; |
267e11c5 | 1315 | wxFontEncoding enc = wxFontMapperBase::Get()->CharsetToEncoding(m_charset, false); |
563d535e VS |
1316 | if ( enc == wxFONTENCODING_SYSTEM ) |
1317 | { | |
7beb59f3 | 1318 | convertEncoding = false; // unknown encoding |
563d535e VS |
1319 | } |
1320 | else | |
1321 | { | |
baf736e1 | 1322 | targetEnc = wxLocale::GetSystemEncoding(); |
563d535e VS |
1323 | if (targetEnc == wxFONTENCODING_SYSTEM) |
1324 | { | |
1325 | wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc); | |
1326 | if (a[0] == enc) | |
1327 | // no conversion needed, locale uses native encoding | |
7beb59f3 | 1328 | convertEncoding = false; |
563d535e VS |
1329 | if (a.GetCount() == 0) |
1330 | // we don't know common equiv. under this platform | |
7beb59f3 | 1331 | convertEncoding = false; |
563d535e VS |
1332 | targetEnc = a[0]; |
1333 | } | |
1334 | } | |
1335 | ||
1336 | if ( convertEncoding ) | |
1337 | { | |
563d535e | 1338 | converter.Init(enc, targetEnc); |
563d535e VS |
1339 | } |
1340 | } | |
563d535e | 1341 | #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T |
0c93d67c | 1342 | (void)convertEncoding; // get rid of warnings about unused parameter |
bc385ba9 | 1343 | |
4a10ea8b | 1344 | for (size_t32 i = 0; i < m_numStrings; i++) |
563d535e | 1345 | { |
849a28d0 | 1346 | const char *data = StringAtOfs(m_pOrigTable, i); |
7a4b1e66 VZ |
1347 | |
1348 | wxString msgid; | |
d721baa9 | 1349 | #if wxUSE_UNICODE |
7a4b1e66 | 1350 | msgid = wxString(data, *inputConv); |
35d10652 | 1351 | #else // ASCII |
f15fa3a9 VZ |
1352 | #if wxUSE_WCHAR_T |
1353 | if ( inputConv && sourceConv ) | |
1354 | msgid = wxString(inputConv->cMB2WC(data), *sourceConv); | |
1355 | else | |
1356 | #endif | |
7a4b1e66 | 1357 | msgid = data; |
d721baa9 | 1358 | #endif // wxUSE_UNICODE |
563d535e | 1359 | |
849a28d0 VS |
1360 | data = StringAtOfs(m_pTransTable, i); |
1361 | size_t length = Swap(m_pTransTable[i].nLen); | |
1362 | size_t offset = 0; | |
1363 | size_t index = 0; | |
1364 | while (offset < length) | |
1365 | { | |
7a4b1e66 VZ |
1366 | const char * const str = data + offset; |
1367 | ||
849a28d0 | 1368 | wxString msgstr; |
7a4b1e66 VZ |
1369 | #if wxUSE_UNICODE |
1370 | msgstr = wxString(str, *inputConv); | |
1371 | #elif wxUSE_WCHAR_T | |
35d10652 | 1372 | if ( inputConv ) |
7a4b1e66 | 1373 | msgstr = wxString(inputConv->cMB2WC(str), *wxConvUI); |
849a28d0 | 1374 | else |
7a4b1e66 | 1375 | msgstr = str; |
849a28d0 VS |
1376 | #else // !wxUSE_WCHAR_T |
1377 | #if wxUSE_FONTMAP | |
1378 | if ( convertEncoding ) | |
7a4b1e66 | 1379 | msgstr = wxString(converter.Convert(str)); |
849a28d0 VS |
1380 | else |
1381 | #endif | |
7a4b1e66 | 1382 | msgstr = str; |
849a28d0 | 1383 | #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T |
9e7ed2b0 | 1384 | |
849a28d0 VS |
1385 | if ( !msgstr.empty() ) |
1386 | { | |
1387 | hash[index == 0 ? msgid : msgid + wxChar(index)] = msgstr; | |
1388 | } | |
7a4b1e66 VZ |
1389 | |
1390 | // skip this string | |
1391 | offset += strlen(str) + 1; | |
849a28d0 VS |
1392 | ++index; |
1393 | } | |
41780009 | 1394 | } |
9e7ed2b0 | 1395 | |
849a28d0 | 1396 | #if wxUSE_WCHAR_T |
d721baa9 | 1397 | delete sourceConv; |
7a4b1e66 VZ |
1398 | delete inputConvPtr; |
1399 | #endif // wxUSE_WCHAR_T | |
563d535e | 1400 | } |
bc385ba9 | 1401 | |
849a28d0 | 1402 | |
563d535e VS |
1403 | // ---------------------------------------------------------------------------- |
1404 | // wxMsgCatalog class | |
1405 | // ---------------------------------------------------------------------------- | |
bc385ba9 | 1406 | |
77c514d1 VZ |
1407 | wxMsgCatalog::~wxMsgCatalog() |
1408 | { | |
1409 | if ( m_conv ) | |
1410 | { | |
1411 | if ( wxConvUI == m_conv ) | |
1412 | { | |
1413 | // we only change wxConvUI if it points to wxConvLocal so we reset | |
1414 | // it back to it too | |
1415 | wxConvUI = &wxConvLocal; | |
1416 | } | |
1417 | ||
1418 | delete m_conv; | |
1419 | } | |
1420 | } | |
1421 | ||
9e7ed2b0 | 1422 | bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName, |
d721baa9 | 1423 | const wxChar *msgIdCharset, bool bConvertEncoding) |
563d535e VS |
1424 | { |
1425 | wxMsgCatalogFile file; | |
9e7ed2b0 | 1426 | |
563d535e | 1427 | m_name = szName; |
9e7ed2b0 | 1428 | |
77c514d1 VZ |
1429 | if ( !file.Load(szDirPrefix, szName, m_pluralFormsCalculator) ) |
1430 | return false; | |
1431 | ||
1432 | file.FillHash(m_messages, msgIdCharset, bConvertEncoding); | |
1433 | ||
1434 | // we should use a conversion compatible with the message catalog encoding | |
1435 | // in the GUI if we don't convert the strings to the current conversion but | |
1436 | // as the encoding is global, only change it once, otherwise we could get | |
1437 | // into trouble if we use several message catalogs with different encodings | |
1438 | // | |
1439 | // this is, of course, a hack but it at least allows the program to use | |
1440 | // message catalogs in any encodings without asking the user to change his | |
1441 | // locale | |
1442 | if ( !bConvertEncoding && | |
1443 | !file.GetCharset().empty() && | |
1444 | wxConvUI == &wxConvLocal ) | |
563d535e | 1445 | { |
77c514d1 VZ |
1446 | wxConvUI = |
1447 | m_conv = new wxCSConv(file.GetCharset()); | |
563d535e | 1448 | } |
821d0fef | 1449 | |
77c514d1 | 1450 | return true; |
afc94fa6 VS |
1451 | } |
1452 | ||
849a28d0 | 1453 | const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const |
563d535e | 1454 | { |
849a28d0 VS |
1455 | int index = 0; |
1456 | if (n != size_t(-1)) | |
1457 | { | |
1458 | index = m_pluralFormsCalculator->evaluate(n); | |
1459 | } | |
1460 | wxMessagesHash::const_iterator i; | |
1461 | if (index != 0) | |
1462 | { | |
1463 | i = m_messages.find(wxString(sz) + wxChar(index)); // plural | |
1464 | } | |
1465 | else | |
1466 | { | |
1467 | i = m_messages.find(sz); | |
1468 | } | |
1469 | ||
563d535e VS |
1470 | if ( i != m_messages.end() ) |
1471 | { | |
1472 | return i->second.c_str(); | |
1473 | } | |
1474 | else | |
1475 | return NULL; | |
1476 | } | |
afc94fa6 | 1477 | |
c801d85f KB |
1478 | // ---------------------------------------------------------------------------- |
1479 | // wxLocale | |
1480 | // ---------------------------------------------------------------------------- | |
1481 | ||
d3f3e35f VS |
1482 | #include "wx/arrimpl.cpp" |
1483 | WX_DECLARE_EXPORTED_OBJARRAY(wxLanguageInfo, wxLanguageInfoArray); | |
4115960d | 1484 | WX_DEFINE_OBJARRAY(wxLanguageInfoArray) |
d3f3e35f | 1485 | |
41780009 VS |
1486 | wxLanguageInfoArray *wxLocale::ms_languagesDB = NULL; |
1487 | ||
1488 | /*static*/ void wxLocale::CreateLanguagesDB() | |
1489 | { | |
1490 | if (ms_languagesDB == NULL) | |
1491 | { | |
1492 | ms_languagesDB = new wxLanguageInfoArray; | |
1493 | InitLanguagesDB(); | |
1494 | } | |
1495 | } | |
1496 | ||
1497 | /*static*/ void wxLocale::DestroyLanguagesDB() | |
1498 | { | |
1499 | delete ms_languagesDB; | |
1500 | ms_languagesDB = NULL; | |
1501 | } | |
1502 | ||
1503 | ||
ea8f6fc7 | 1504 | void wxLocale::DoCommonInit() |
c801d85f | 1505 | { |
23fcecf7 | 1506 | m_pszOldLocale = NULL; |
eb48778d VZ |
1507 | |
1508 | m_pOldLocale = wxSetLocale(this); | |
1509 | ||
23fcecf7 | 1510 | m_pMsgCat = NULL; |
d3f3e35f | 1511 | m_language = wxLANGUAGE_UNKNOWN; |
3202d00d | 1512 | m_initialized = false; |
23fcecf7 VZ |
1513 | } |
1514 | ||
1515 | // NB: this function has (desired) side effect of changing current locale | |
e36e6f95 OK |
1516 | bool wxLocale::Init(const wxChar *szName, |
1517 | const wxChar *szShort, | |
1518 | const wxChar *szLocale, | |
afc94fa6 VS |
1519 | bool bLoadDefault, |
1520 | bool bConvertEncoding) | |
23fcecf7 | 1521 | { |
3202d00d VS |
1522 | wxASSERT_MSG( !m_initialized, |
1523 | _T("you can't call wxLocale::Init more than once") ); | |
b7b97e77 | 1524 | |
3202d00d | 1525 | m_initialized = true; |
23fcecf7 VZ |
1526 | m_strLocale = szName; |
1527 | m_strShort = szShort; | |
afc94fa6 | 1528 | m_bConvertEncoding = bConvertEncoding; |
d3f3e35f | 1529 | m_language = wxLANGUAGE_UNKNOWN; |
23fcecf7 | 1530 | |
c801d85f KB |
1531 | // change current locale (default: same as long name) |
1532 | if ( szLocale == NULL ) | |
9dea50fc VZ |
1533 | { |
1534 | // the argument to setlocale() | |
1535 | szLocale = szShort; | |
52558258 | 1536 | |
7beb59f3 | 1537 | wxCHECK_MSG( szLocale, false, _T("no locale to set in wxLocale::Init()") ); |
9dea50fc | 1538 | } |
10545ca4 | 1539 | |
1c193821 JS |
1540 | #ifdef __WXWINCE__ |
1541 | // FIXME: I'm guessing here | |
1542 | wxChar localeName[256]; | |
1543 | int ret = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLANGUAGE, localeName, | |
1544 | 256); | |
1545 | if (ret != 0) | |
1546 | { | |
b7b97e77 | 1547 | m_pszOldLocale = wxStrdup(localeName); |
1c193821 JS |
1548 | } |
1549 | else | |
1550 | m_pszOldLocale = NULL; | |
1551 | ||
1552 | // TODO: how to find languageId | |
1553 | // SetLocaleInfo(languageId, SORT_DEFAULT, localeName); | |
1554 | #else | |
c76b6474 VS |
1555 | wxMB2WXbuf oldLocale = wxSetlocale(LC_ALL, szLocale); |
1556 | if ( oldLocale ) | |
1557 | m_pszOldLocale = wxStrdup(oldLocale); | |
1558 | else | |
1559 | m_pszOldLocale = NULL; | |
1c193821 JS |
1560 | #endif |
1561 | ||
c801d85f | 1562 | if ( m_pszOldLocale == NULL ) |
1a5a8367 | 1563 | wxLogError(_("locale '%s' can not be set."), szLocale); |
c801d85f KB |
1564 | |
1565 | // the short name will be used to look for catalog files as well, | |
1566 | // so we need something here | |
525d8583 | 1567 | if ( m_strShort.empty() ) { |
fd323a5e VZ |
1568 | // FIXME I don't know how these 2 letter abbreviations are formed, |
1569 | // this wild guess is surely wrong | |
c7c06291 | 1570 | if ( szLocale && szLocale[0] ) |
70426fba VZ |
1571 | { |
1572 | m_strShort += (wxChar)wxTolower(szLocale[0]); | |
1573 | if ( szLocale[1] ) | |
1574 | m_strShort += (wxChar)wxTolower(szLocale[1]); | |
1575 | } | |
c801d85f | 1576 | } |
7af89395 | 1577 | |
77ffb593 | 1578 | // load the default catalog with wxWidgets standard messages |
c801d85f | 1579 | m_pMsgCat = NULL; |
7beb59f3 | 1580 | bool bOk = true; |
c801d85f | 1581 | if ( bLoadDefault ) |
4d931bcc | 1582 | { |
223d09f6 | 1583 | bOk = AddCatalog(wxT("wxstd")); |
23fcecf7 | 1584 | |
4d931bcc MW |
1585 | // there may be a catalog with toolkit specific overrides, it is not |
1586 | // an error if this does not exist | |
1587 | if ( bOk && wxTheApp ) | |
1588 | { | |
1589 | wxAppTraits *traits = wxTheApp->GetTraits(); | |
1590 | if (traits) | |
1591 | AddCatalog(traits->GetToolkitInfo().name.BeforeFirst(wxT('/')).MakeLower()); | |
1592 | } | |
1593 | } | |
1594 | ||
23fcecf7 | 1595 | return bOk; |
c801d85f KB |
1596 | } |
1597 | ||
41524ffc | 1598 | |
1cc549e5 | 1599 | #if defined(__UNIX__) && wxUSE_UNICODE && !defined(__WXMAC__) |
41524ffc VS |
1600 | static wxWCharBuffer wxSetlocaleTryUTF(int c, const wxChar *lc) |
1601 | { | |
1602 | wxMB2WXbuf l = wxSetlocale(c, lc); | |
2d34a303 | 1603 | if ( !l && lc && lc[0] != 0 ) |
41524ffc | 1604 | { |
7beb59f3 | 1605 | wxString buf(lc); |
2d34a303 | 1606 | wxString buf2; |
7beb59f3 WS |
1607 | buf2 = buf + wxT(".UTF-8"); |
1608 | l = wxSetlocale(c, buf2.c_str()); | |
2d34a303 VS |
1609 | if ( !l ) |
1610 | { | |
1611 | buf2 = buf + wxT(".utf-8"); | |
7beb59f3 | 1612 | l = wxSetlocale(c, buf2.c_str()); |
2d34a303 VS |
1613 | } |
1614 | if ( !l ) | |
1615 | { | |
1616 | buf2 = buf + wxT(".UTF8"); | |
7beb59f3 | 1617 | l = wxSetlocale(c, buf2.c_str()); |
2d34a303 VS |
1618 | } |
1619 | if ( !l ) | |
1620 | { | |
1621 | buf2 = buf + wxT(".utf8"); | |
7beb59f3 | 1622 | l = wxSetlocale(c, buf2.c_str()); |
2d34a303 | 1623 | } |
41524ffc VS |
1624 | } |
1625 | return l; | |
1626 | } | |
1627 | #else | |
1628 | #define wxSetlocaleTryUTF(c, lc) wxSetlocale(c, lc) | |
1629 | #endif | |
1630 | ||
d3f3e35f VS |
1631 | bool wxLocale::Init(int language, int flags) |
1632 | { | |
d3f3e35f | 1633 | int lang = language; |
ec37df57 VZ |
1634 | if (lang == wxLANGUAGE_DEFAULT) |
1635 | { | |
1636 | // auto detect the language | |
1637 | lang = GetSystemLanguage(); | |
1638 | } | |
1639 | ||
1640 | // We failed to detect system language, so we will use English: | |
1641 | if (lang == wxLANGUAGE_UNKNOWN) | |
1642 | { | |
7beb59f3 | 1643 | return false; |
ec37df57 VZ |
1644 | } |
1645 | ||
14f8fa9d | 1646 | const wxLanguageInfo *info = GetLanguageInfo(lang); |
d3f3e35f | 1647 | |
d3f3e35f VS |
1648 | // Unknown language: |
1649 | if (info == NULL) | |
1650 | { | |
1651 | wxLogError(wxT("Unknown language %i."), lang); | |
7beb59f3 | 1652 | return false; |
d3f3e35f VS |
1653 | } |
1654 | ||
1655 | wxString name = info->Description; | |
1656 | wxString canonical = info->CanonicalName; | |
1657 | wxString locale; | |
ec37df57 | 1658 | |
d3f3e35f | 1659 | // Set the locale: |
55034339 WS |
1660 | #if defined(__OS2__) |
1661 | wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString); | |
1662 | #elif defined(__UNIX__) && !defined(__WXMAC__) | |
d368dbea | 1663 | if (language != wxLANGUAGE_DEFAULT) |
ec37df57 | 1664 | locale = info->CanonicalName; |
d3f3e35f | 1665 | |
41524ffc | 1666 | wxMB2WXbuf retloc = wxSetlocaleTryUTF(LC_ALL, locale); |
d3f3e35f | 1667 | |
d368dbea | 1668 | const wxString langOnly = locale.Left(2); |
2b5f62a0 | 1669 | if ( !retloc ) |
d3f3e35f VS |
1670 | { |
1671 | // Some C libraries don't like xx_YY form and require xx only | |
d368dbea | 1672 | retloc = wxSetlocaleTryUTF(LC_ALL, langOnly); |
d3f3e35f | 1673 | } |
d368dbea VZ |
1674 | |
1675 | #if wxUSE_FONTMAP | |
1676 | // some systems (e.g. FreeBSD and HP-UX) don't have xx_YY aliases but | |
1677 | // require the full xx_YY.encoding form, so try using UTF-8 because this is | |
1678 | // the only thing we can do generically | |
1679 | // | |
1680 | // TODO: add encodings applicable to each language to the lang DB and try | |
1681 | // them all in turn here | |
2b5f62a0 | 1682 | if ( !retloc ) |
d3f3e35f | 1683 | { |
d368dbea VZ |
1684 | const wxChar **names = |
1685 | wxFontMapperBase::GetAllEncodingNames(wxFONTENCODING_UTF8); | |
1686 | while ( *names ) | |
1687 | { | |
1688 | retloc = wxSetlocale(LC_ALL, locale + _T('.') + *names++); | |
1689 | if ( retloc ) | |
1690 | break; | |
1691 | } | |
d3f3e35f | 1692 | } |
d368dbea VZ |
1693 | #endif // wxUSE_FONTMAP |
1694 | ||
2b5f62a0 | 1695 | if ( !retloc ) |
d3f3e35f | 1696 | { |
d368dbea VZ |
1697 | // Some C libraries (namely glibc) still use old ISO 639, |
1698 | // so will translate the abbrev for them | |
1699 | wxString localeAlt; | |
1700 | if ( langOnly == wxT("he") ) | |
1701 | localeAlt = wxT("iw") + locale.Mid(3); | |
1702 | else if ( langOnly == wxT("id") ) | |
1703 | localeAlt = wxT("in") + locale.Mid(3); | |
1704 | else if ( langOnly == wxT("yi") ) | |
1705 | localeAlt = wxT("ji") + locale.Mid(3); | |
1706 | else if ( langOnly == wxT("nb") ) | |
1707 | localeAlt = wxT("no_NO"); | |
1708 | else if ( langOnly == wxT("nn") ) | |
1709 | localeAlt = wxT("no_NY"); | |
1710 | ||
1711 | if ( !localeAlt.empty() ) | |
1712 | { | |
1713 | retloc = wxSetlocaleTryUTF(LC_ALL, localeAlt); | |
1714 | if ( !retloc ) | |
1715 | retloc = wxSetlocaleTryUTF(LC_ALL, locale.Left(2)); | |
1716 | } | |
d3f3e35f | 1717 | } |
d368dbea | 1718 | |
2b5f62a0 | 1719 | if ( !retloc ) |
d3f3e35f VS |
1720 | { |
1721 | wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); | |
7beb59f3 | 1722 | return false; |
d3f3e35f | 1723 | } |
d368dbea VZ |
1724 | |
1725 | #ifdef __AIX__ | |
1726 | // at least in AIX 5.2 libc is buggy and the string returned from setlocale(LC_ALL) | |
1727 | // can't be passed back to it because it returns 6 strings (one for each locale | |
1728 | // category), i.e. for C locale we get back "C C C C C C" | |
1729 | // | |
1730 | // this contradicts IBM own docs but this is not of much help, so just work around | |
1731 | // it in the crudest possible manner | |
1732 | wxChar *p = wxStrchr((wxChar *)retloc, _T(' ')); | |
1733 | if ( p ) | |
1734 | *p = _T('\0'); | |
1735 | #endif // __AIX__ | |
1736 | ||
d3f3e35f | 1737 | #elif defined(__WIN32__) |
65dc921d VS |
1738 | |
1739 | #if wxUSE_UNICODE && (defined(__VISUALC__) || defined(__MINGW32__)) | |
1740 | // NB: setlocale() from msvcrt.dll (used by VC++ and Mingw) | |
1741 | // can't set locale to language that can only be written using | |
1742 | // Unicode. Therefore wxSetlocale call failed, but we don't want | |
1743 | // to report it as an error -- so that at least message catalogs | |
1744 | // can be used. Watch for code marked with | |
1745 | // #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS bellow. | |
1746 | #define SETLOCALE_FAILS_ON_UNICODE_LANGS | |
1747 | #endif | |
b7b97e77 VZ |
1748 | |
1749 | #if !wxUSE_UNICODE | |
1750 | const | |
1751 | #endif | |
2b5f62a0 | 1752 | wxMB2WXbuf retloc = wxT("C"); |
d3f3e35f VS |
1753 | if (language != wxLANGUAGE_DEFAULT) |
1754 | { | |
63986ba6 | 1755 | if (info->WinLang == 0) |
d3f3e35f | 1756 | { |
63986ba6 | 1757 | wxLogWarning(wxT("Locale '%s' not supported by OS."), name.c_str()); |
2b5f62a0 | 1758 | // retloc already set to "C" |
63986ba6 VS |
1759 | } |
1760 | else | |
ec37df57 | 1761 | { |
b7b97e77 | 1762 | int codepage |
999836aa VZ |
1763 | #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS |
1764 | = -1 | |
1765 | #endif | |
1766 | ; | |
ec37df57 | 1767 | wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), |
63986ba6 | 1768 | SORT_DEFAULT); |
1c193821 JS |
1769 | // FIXME |
1770 | #ifndef __WXWINCE__ | |
65dc921d | 1771 | SetThreadLocale(lcid); |
1c193821 | 1772 | #endif |
65dc921d VS |
1773 | // NB: we must translate LCID to CRT's setlocale string ourselves, |
1774 | // because SetThreadLocale does not modify change the | |
1775 | // interpretation of setlocale(LC_ALL, "") call: | |
1776 | wxChar buffer[256]; | |
1777 | buffer[0] = wxT('\0'); | |
1778 | GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, 256); | |
1779 | locale << buffer; | |
1780 | if (GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, buffer, 256) > 0) | |
1781 | locale << wxT("_") << buffer; | |
1782 | if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buffer, 256) > 0) | |
1783 | { | |
1784 | codepage = wxAtoi(buffer); | |
1785 | if (codepage != 0) | |
1786 | locale << wxT(".") << buffer; | |
1787 | } | |
525d8583 | 1788 | if (locale.empty()) |
2b5f62a0 | 1789 | { |
65dc921d VS |
1790 | wxLogLastError(wxT("SetThreadLocale")); |
1791 | wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); | |
7beb59f3 | 1792 | return false; |
2b5f62a0 | 1793 | } |
63986ba6 | 1794 | else |
c611452f | 1795 | { |
1c193821 JS |
1796 | // FIXME |
1797 | #ifndef __WXWINCE__ | |
65dc921d | 1798 | retloc = wxSetlocale(LC_ALL, locale); |
1c193821 | 1799 | #endif |
65dc921d VS |
1800 | #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS |
1801 | if (codepage == 0 && (const wxChar*)retloc == NULL) | |
2b5f62a0 | 1802 | { |
65dc921d | 1803 | retloc = wxT("C"); |
2b5f62a0 | 1804 | } |
65dc921d | 1805 | #endif |
c611452f | 1806 | } |
d3f3e35f VS |
1807 | } |
1808 | } | |
c611452f | 1809 | else |
2b5f62a0 | 1810 | { |
1c193821 JS |
1811 | // FIXME |
1812 | #ifndef __WXWINCE__ | |
c611452f | 1813 | retloc = wxSetlocale(LC_ALL, wxEmptyString); |
1c193821 JS |
1814 | #else |
1815 | retloc = NULL; | |
1816 | #endif | |
65dc921d VS |
1817 | #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS |
1818 | if ((const wxChar*)retloc == NULL) | |
1819 | { | |
1820 | wxChar buffer[16]; | |
1821 | if (GetLocaleInfo(LOCALE_USER_DEFAULT, | |
1822 | LOCALE_IDEFAULTANSICODEPAGE, buffer, 16) > 0 && | |
1823 | wxStrcmp(buffer, wxT("0")) == 0) | |
1824 | { | |
1825 | retloc = wxT("C"); | |
1826 | } | |
1827 | } | |
1828 | #endif | |
2b5f62a0 | 1829 | } |
c611452f | 1830 | |
2b5f62a0 | 1831 | if ( !retloc ) |
d3f3e35f VS |
1832 | { |
1833 | wxLogError(wxT("Cannot set locale to language %s."), name.c_str()); | |
7beb59f3 | 1834 | return false; |
d3f3e35f | 1835 | } |
85fb2206 | 1836 | #elif defined(__WXMAC__) |
b51daa4f | 1837 | if (lang == wxLANGUAGE_DEFAULT) |
85fb2206 SC |
1838 | locale = wxEmptyString; |
1839 | else | |
1840 | locale = info->CanonicalName; | |
1841 | ||
1842 | wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale); | |
1843 | ||
1844 | if ( !retloc ) | |
1845 | { | |
1846 | // Some C libraries don't like xx_YY form and require xx only | |
1847 | retloc = wxSetlocale(LC_ALL, locale.Mid(0,2)); | |
1848 | } | |
1849 | if ( !retloc ) | |
1850 | { | |
1851 | wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str()); | |
1852 | return false; | |
1853 | } | |
d3f3e35f | 1854 | #else |
ead190e4 | 1855 | wxUnusedVar(flags); |
7beb59f3 | 1856 | return false; |
e879e020 | 1857 | #define WX_NO_LOCALE_SUPPORT |
d3f3e35f | 1858 | #endif |
ec37df57 | 1859 | |
e879e020 | 1860 | #ifndef WX_NO_LOCALE_SUPPORT |
10545ca4 | 1861 | wxChar *szLocale = retloc ? wxStrdup(retloc) : NULL; |
b7e1957a | 1862 | bool ret = Init(name, canonical, szLocale, |
b78a78f7 VS |
1863 | (flags & wxLOCALE_LOAD_DEFAULT) != 0, |
1864 | (flags & wxLOCALE_CONV_ENCODING) != 0); | |
10545ca4 VZ |
1865 | free(szLocale); |
1866 | ||
549a7c37 | 1867 | if (IsOk()) // setlocale() succeeded |
10545ca4 VZ |
1868 | m_language = lang; |
1869 | ||
b78a78f7 | 1870 | return ret; |
b7e1957a | 1871 | #endif // !WX_NO_LOCALE_SUPPORT |
d3f3e35f VS |
1872 | } |
1873 | ||
1874 | ||
1875 | ||
fd323a5e VZ |
1876 | void wxLocale::AddCatalogLookupPathPrefix(const wxString& prefix) |
1877 | { | |
f830b2b1 | 1878 | if ( gs_searchPrefixes.Index(prefix) == wxNOT_FOUND ) |
fd323a5e | 1879 | { |
f830b2b1 | 1880 | gs_searchPrefixes.Add(prefix); |
fd323a5e VZ |
1881 | } |
1882 | //else: already have it | |
1883 | } | |
1884 | ||
41780009 | 1885 | /*static*/ int wxLocale::GetSystemLanguage() |
d3f3e35f | 1886 | { |
41780009 | 1887 | CreateLanguagesDB(); |
ec37df57 VZ |
1888 | |
1889 | // init i to avoid compiler warning | |
1890 | size_t i = 0, | |
41780009 | 1891 | count = ms_languagesDB->GetCount(); |
d3f3e35f | 1892 | |
432e8391 | 1893 | #if defined(__UNIX__) && !defined(__WXMAC__) |
ec37df57 VZ |
1894 | // first get the string identifying the language from the environment |
1895 | wxString langFull; | |
1896 | if (!wxGetEnv(wxT("LC_ALL"), &langFull) && | |
1897 | !wxGetEnv(wxT("LC_MESSAGES"), &langFull) && | |
1898 | !wxGetEnv(wxT("LANG"), &langFull)) | |
1899 | { | |
41780009 VS |
1900 | // no language specified, threat it as English |
1901 | return wxLANGUAGE_ENGLISH; | |
ec37df57 | 1902 | } |
d3f3e35f | 1903 | |
efd1393b | 1904 | if ( langFull == _T("C") || langFull == _T("POSIX") ) |
d3f3e35f | 1905 | { |
ec37df57 | 1906 | // default C locale |
41780009 | 1907 | return wxLANGUAGE_ENGLISH; |
d3f3e35f VS |
1908 | } |
1909 | ||
ec37df57 VZ |
1910 | // the language string has the following form |
1911 | // | |
efd1393b | 1912 | // lang[_LANG][.encoding][@modifier] |
ec37df57 | 1913 | // |
efd1393b VZ |
1914 | // (see environ(5) in the Open Unix specification) |
1915 | // | |
1916 | // where lang is the primary language, LANG is a sublang/territory, | |
1917 | // encoding is the charset to use and modifier "allows the user to select | |
1918 | // a specific instance of localization data within a single category" | |
ec37df57 VZ |
1919 | // |
1920 | // for example, the following strings are valid: | |
1921 | // fr | |
1922 | // fr_FR | |
1923 | // de_DE.iso88591 | |
efd1393b VZ |
1924 | // de_DE@euro |
1925 | // de_DE.iso88591@euro | |
ec37df57 VZ |
1926 | |
1927 | // for now we don't use the encoding, although we probably should (doing | |
1928 | // translations of the msg catalogs on the fly as required) (TODO) | |
efd1393b VZ |
1929 | // |
1930 | // we don't use the modifiers neither but we probably should translate | |
1931 | // "euro" into iso885915 | |
1932 | size_t posEndLang = langFull.find_first_of(_T("@.")); | |
1933 | if ( posEndLang != wxString::npos ) | |
1934 | { | |
1935 | langFull.Truncate(posEndLang); | |
1936 | } | |
ec37df57 VZ |
1937 | |
1938 | // in addition to the format above, we also can have full language names | |
1939 | // in LANG env var - for example, SuSE is known to use LANG="german" - so | |
1940 | // check for this | |
1941 | ||
1942 | // do we have just the language (or sublang too)? | |
1943 | bool justLang = langFull.Len() == LEN_LANG; | |
1944 | if ( justLang || | |
1945 | (langFull.Len() == LEN_FULL && langFull[LEN_LANG] == wxT('_')) ) | |
d3f3e35f | 1946 | { |
ec37df57 | 1947 | // 0. Make sure the lang is according to latest ISO 639 |
3103e8a9 | 1948 | // (this is necessary because glibc uses iw and in instead |
ec37df57 VZ |
1949 | // of he and id respectively). |
1950 | ||
1951 | // the language itself (second part is the dialect/sublang) | |
1952 | wxString langOrig = ExtractLang(langFull); | |
1953 | ||
1954 | wxString lang; | |
1955 | if ( langOrig == wxT("iw")) | |
1956 | lang = _T("he"); | |
cf5e94bc | 1957 | else if (langOrig == wxT("in")) |
ec37df57 | 1958 | lang = wxT("id"); |
cf5e94bc | 1959 | else if (langOrig == wxT("ji")) |
ec37df57 | 1960 | lang = wxT("yi"); |
cf5e94bc VS |
1961 | else if (langOrig == wxT("no_NO")) |
1962 | lang = wxT("nb_NO"); | |
1963 | else if (langOrig == wxT("no_NY")) | |
1964 | lang = wxT("nn_NO"); | |
1965 | else if (langOrig == wxT("no")) | |
1966 | lang = wxT("nb_NO"); | |
ec37df57 VZ |
1967 | else |
1968 | lang = langOrig; | |
1969 | ||
1970 | // did we change it? | |
1971 | if ( lang != langOrig ) | |
d3f3e35f | 1972 | { |
ec37df57 VZ |
1973 | langFull = lang + ExtractNotLang(langFull); |
1974 | } | |
1975 | ||
1976 | // 1. Try to find the language either as is: | |
1977 | for ( i = 0; i < count; i++ ) | |
1978 | { | |
41780009 | 1979 | if ( ms_languagesDB->Item(i).CanonicalName == langFull ) |
d3f3e35f | 1980 | { |
d3f3e35f VS |
1981 | break; |
1982 | } | |
1983 | } | |
d3f3e35f | 1984 | |
ec37df57 VZ |
1985 | // 2. If langFull is of the form xx_YY, try to find xx: |
1986 | if ( i == count && !justLang ) | |
d3f3e35f | 1987 | { |
ec37df57 | 1988 | for ( i = 0; i < count; i++ ) |
d3f3e35f | 1989 | { |
41780009 | 1990 | if ( ms_languagesDB->Item(i).CanonicalName == lang ) |
ec37df57 VZ |
1991 | { |
1992 | break; | |
1993 | } | |
d3f3e35f VS |
1994 | } |
1995 | } | |
d3f3e35f | 1996 | |
ec37df57 VZ |
1997 | // 3. If langFull is of the form xx, try to find any xx_YY record: |
1998 | if ( i == count && justLang ) | |
d3f3e35f | 1999 | { |
ec37df57 | 2000 | for ( i = 0; i < count; i++ ) |
d3f3e35f | 2001 | { |
41780009 | 2002 | if ( ExtractLang(ms_languagesDB->Item(i).CanonicalName) |
ec37df57 VZ |
2003 | == langFull ) |
2004 | { | |
2005 | break; | |
2006 | } | |
d3f3e35f VS |
2007 | } |
2008 | } | |
2009 | } | |
ec37df57 | 2010 | else // not standard format |
d3f3e35f | 2011 | { |
ec37df57 VZ |
2012 | // try to find the name in verbose description |
2013 | for ( i = 0; i < count; i++ ) | |
d3f3e35f | 2014 | { |
41780009 | 2015 | if (ms_languagesDB->Item(i).Description.CmpNoCase(langFull) == 0) |
d3f3e35f | 2016 | { |
d3f3e35f VS |
2017 | break; |
2018 | } | |
2019 | } | |
2020 | } | |
0e32fdb8 | 2021 | #elif defined(__WXMAC__) |
44c44c82 | 2022 | const wxChar * lc = NULL ; |
0e32fdb8 SC |
2023 | long lang = GetScriptVariable( smSystemScript, smScriptLang) ; |
2024 | switch( GetScriptManagerVariable( smRegionCode ) ) { | |
2025 | case verUS : | |
44c44c82 | 2026 | lc = wxT("en_US") ; |
0e32fdb8 SC |
2027 | break ; |
2028 | case verFrance : | |
44c44c82 | 2029 | lc = wxT("fr_FR") ; |
0e32fdb8 SC |
2030 | break ; |
2031 | case verBritain : | |
44c44c82 | 2032 | lc = wxT("en_GB") ; |
0e32fdb8 SC |
2033 | break ; |
2034 | case verGermany : | |
44c44c82 | 2035 | lc = wxT("de_DE") ; |
0e32fdb8 SC |
2036 | break ; |
2037 | case verItaly : | |
44c44c82 | 2038 | lc = wxT("it_IT") ; |
0e32fdb8 SC |
2039 | break ; |
2040 | case verNetherlands : | |
44c44c82 | 2041 | lc = wxT("nl_NL") ; |
0e32fdb8 SC |
2042 | break ; |
2043 | case verFlemish : | |
44c44c82 | 2044 | lc = wxT("nl_BE") ; |
0e32fdb8 SC |
2045 | break ; |
2046 | case verSweden : | |
44c44c82 | 2047 | lc = wxT("sv_SE" ); |
0e32fdb8 SC |
2048 | break ; |
2049 | case verSpain : | |
44c44c82 | 2050 | lc = wxT("es_ES" ); |
0e32fdb8 SC |
2051 | break ; |
2052 | case verDenmark : | |
44c44c82 | 2053 | lc = wxT("da_DK") ; |
0e32fdb8 SC |
2054 | break ; |
2055 | case verPortugal : | |
44c44c82 | 2056 | lc = wxT("pt_PT") ; |
0e32fdb8 SC |
2057 | break ; |
2058 | case verFrCanada: | |
44c44c82 | 2059 | lc = wxT("fr_CA") ; |
0e32fdb8 SC |
2060 | break ; |
2061 | case verNorway: | |
cf5e94bc | 2062 | lc = wxT("nb_NO") ; |
0e32fdb8 SC |
2063 | break ; |
2064 | case verIsrael: | |
44c44c82 | 2065 | lc = wxT("iw_IL") ; |
0e32fdb8 SC |
2066 | break ; |
2067 | case verJapan: | |
44c44c82 | 2068 | lc = wxT("ja_JP") ; |
0e32fdb8 SC |
2069 | break ; |
2070 | case verAustralia: | |
44c44c82 | 2071 | lc = wxT("en_AU") ; |
0e32fdb8 SC |
2072 | break ; |
2073 | case verArabic: | |
44c44c82 | 2074 | lc = wxT("ar") ; |
0e32fdb8 SC |
2075 | break ; |
2076 | case verFinland: | |
44c44c82 | 2077 | lc = wxT("fi_FI") ; |
0e32fdb8 SC |
2078 | break ; |
2079 | case verFrSwiss: | |
44c44c82 | 2080 | lc = wxT("fr_CH") ; |
0e32fdb8 SC |
2081 | break ; |
2082 | case verGrSwiss: | |
44c44c82 | 2083 | lc = wxT("de_CH") ; |
0e32fdb8 SC |
2084 | break ; |
2085 | case verGreece: | |
44c44c82 | 2086 | lc = wxT("el_GR") ; |
0e32fdb8 SC |
2087 | break ; |
2088 | case verIceland: | |
44c44c82 | 2089 | lc = wxT("is_IS") ; |
0e32fdb8 SC |
2090 | break ; |
2091 | case verMalta: | |
44c44c82 | 2092 | lc = wxT("mt_MT") ; |
0e32fdb8 SC |
2093 | break ; |
2094 | case verCyprus: | |
2095 | // _CY is not part of wx, so we have to translate according to the system language | |
2096 | if ( lang == langGreek ) { | |
44c44c82 | 2097 | lc = wxT("el_GR") ; |
0e32fdb8 SC |
2098 | } |
2099 | else if ( lang == langTurkish ) { | |
44c44c82 | 2100 | lc = wxT("tr_TR") ; |
0e32fdb8 SC |
2101 | } |
2102 | break ; | |
2103 | case verTurkey: | |
44c44c82 | 2104 | lc = wxT("tr_TR") ; |
0e32fdb8 SC |
2105 | break ; |
2106 | case verYugoCroatian: | |
44c44c82 | 2107 | lc = wxT("hr_HR") ; |
0e32fdb8 SC |
2108 | break ; |
2109 | case verIndiaHindi: | |
44c44c82 | 2110 | lc = wxT("hi_IN") ; |
0e32fdb8 SC |
2111 | break ; |
2112 | case verPakistanUrdu: | |
44c44c82 | 2113 | lc = wxT("ur_PK") ; |
0e32fdb8 SC |
2114 | break ; |
2115 | case verTurkishModified: | |
44c44c82 | 2116 | lc = wxT("tr_TR") ; |
0e32fdb8 SC |
2117 | break ; |
2118 | case verItalianSwiss: | |
44c44c82 | 2119 | lc = wxT("it_CH") ; |
0e32fdb8 SC |
2120 | break ; |
2121 | case verInternational: | |
44c44c82 | 2122 | lc = wxT("en") ; |
0e32fdb8 SC |
2123 | break ; |
2124 | case verRomania: | |
44c44c82 | 2125 | lc = wxT("ro_RO") ; |
0e32fdb8 SC |
2126 | break ; |
2127 | case verGreecePoly: | |
44c44c82 | 2128 | lc = wxT("el_GR") ; |
0e32fdb8 SC |
2129 | break ; |
2130 | case verLithuania: | |
44c44c82 | 2131 | lc = wxT("lt_LT") ; |
0e32fdb8 SC |
2132 | break ; |
2133 | case verPoland: | |
44c44c82 | 2134 | lc = wxT("pl_PL") ; |
0e32fdb8 SC |
2135 | break ; |
2136 | case verMagyar : | |
2137 | case verHungary: | |
44c44c82 | 2138 | lc = wxT("hu_HU") ; |
0e32fdb8 SC |
2139 | break ; |
2140 | case verEstonia: | |
44c44c82 | 2141 | lc = wxT("et_EE") ; |
0e32fdb8 SC |
2142 | break ; |
2143 | case verLatvia: | |
44c44c82 | 2144 | lc = wxT("lv_LV") ; |
0e32fdb8 SC |
2145 | break ; |
2146 | case verSami: | |
2147 | // not known | |
2148 | break ; | |
2149 | case verFaroeIsl: | |
44c44c82 | 2150 | lc = wxT("fo_FO") ; |
0e32fdb8 SC |
2151 | break ; |
2152 | case verIran: | |
44c44c82 | 2153 | lc = wxT("fa_IR") ; |
0e32fdb8 SC |
2154 | break ; |
2155 | case verRussia: | |
44c44c82 | 2156 | lc = wxT("ru_RU") ; |
0e32fdb8 SC |
2157 | break ; |
2158 | case verIreland: | |
44c44c82 | 2159 | lc = wxT("ga_IE") ; |
0e32fdb8 SC |
2160 | break ; |
2161 | case verKorea: | |
44c44c82 | 2162 | lc = wxT("ko_KR") ; |
0e32fdb8 SC |
2163 | break ; |
2164 | case verChina: | |
44c44c82 | 2165 | lc = wxT("zh_CN") ; |
0e32fdb8 SC |
2166 | break ; |
2167 | case verTaiwan: | |
44c44c82 | 2168 | lc = wxT("zh_TW") ; |
0e32fdb8 SC |
2169 | break ; |
2170 | case verThailand: | |
44c44c82 | 2171 | lc = wxT("th_TH") ; |
0e32fdb8 SC |
2172 | break ; |
2173 | case verCzech: | |
44c44c82 | 2174 | lc = wxT("cs_CZ") ; |
0e32fdb8 SC |
2175 | break ; |
2176 | case verSlovak: | |
44c44c82 | 2177 | lc = wxT("sk_SK") ; |
0e32fdb8 SC |
2178 | break ; |
2179 | case verBengali: | |
44c44c82 | 2180 | lc = wxT("bn") ; |
0e32fdb8 SC |
2181 | break ; |
2182 | case verByeloRussian: | |
44c44c82 | 2183 | lc = wxT("be_BY") ; |
0e32fdb8 SC |
2184 | break ; |
2185 | case verUkraine: | |
44c44c82 | 2186 | lc = wxT("uk_UA") ; |
0e32fdb8 SC |
2187 | break ; |
2188 | case verGreeceAlt: | |
44c44c82 | 2189 | lc = wxT("el_GR") ; |
0e32fdb8 SC |
2190 | break ; |
2191 | case verSerbian: | |
44c44c82 | 2192 | lc = wxT("sr_YU") ; |
0e32fdb8 SC |
2193 | break ; |
2194 | case verSlovenian: | |
44c44c82 | 2195 | lc = wxT("sl_SI") ; |
0e32fdb8 SC |
2196 | break ; |
2197 | case verMacedonian: | |
44c44c82 | 2198 | lc = wxT("mk_MK") ; |
0e32fdb8 SC |
2199 | break ; |
2200 | case verCroatia: | |
44c44c82 | 2201 | lc = wxT("hr_HR") ; |
0e32fdb8 SC |
2202 | break ; |
2203 | case verBrazil: | |
44c44c82 | 2204 | lc = wxT("pt_BR ") ; |
0e32fdb8 SC |
2205 | break ; |
2206 | case verBulgaria: | |
44c44c82 | 2207 | lc = wxT("bg_BG") ; |
0e32fdb8 SC |
2208 | break ; |
2209 | case verCatalonia: | |
44c44c82 | 2210 | lc = wxT("ca_ES") ; |
0e32fdb8 SC |
2211 | break ; |
2212 | case verScottishGaelic: | |
44c44c82 | 2213 | lc = wxT("gd") ; |
0e32fdb8 SC |
2214 | break ; |
2215 | case verManxGaelic: | |
44c44c82 | 2216 | lc = wxT("gv") ; |
0e32fdb8 SC |
2217 | break ; |
2218 | case verBreton: | |
44c44c82 | 2219 | lc = wxT("br") ; |
0e32fdb8 SC |
2220 | break ; |
2221 | case verNunavut: | |
44c44c82 | 2222 | lc = wxT("iu_CA") ; |
0e32fdb8 SC |
2223 | break ; |
2224 | case verWelsh: | |
44c44c82 | 2225 | lc = wxT("cy") ; |
0e32fdb8 SC |
2226 | break ; |
2227 | case verIrishGaelicScript: | |
44c44c82 | 2228 | lc = wxT("ga_IE") ; |
0e32fdb8 SC |
2229 | break ; |
2230 | case verEngCanada: | |
44c44c82 | 2231 | lc = wxT("en_CA") ; |
0e32fdb8 SC |
2232 | break ; |
2233 | case verBhutan: | |
44c44c82 | 2234 | lc = wxT("dz_BT") ; |
0e32fdb8 SC |
2235 | break ; |
2236 | case verArmenian: | |
44c44c82 | 2237 | lc = wxT("hy_AM") ; |
0e32fdb8 SC |
2238 | break ; |
2239 | case verGeorgian: | |
44c44c82 | 2240 | lc = wxT("ka_GE") ; |
0e32fdb8 SC |
2241 | break ; |
2242 | case verSpLatinAmerica: | |
44c44c82 | 2243 | lc = wxT("es_AR") ; |
0e32fdb8 SC |
2244 | break ; |
2245 | case verTonga: | |
44c44c82 | 2246 | lc = wxT("to_TO" ); |
0e32fdb8 SC |
2247 | break ; |
2248 | case verFrenchUniversal: | |
44c44c82 | 2249 | lc = wxT("fr_FR") ; |
0e32fdb8 SC |
2250 | break ; |
2251 | case verAustria: | |
44c44c82 | 2252 | lc = wxT("de_AT") ; |
0e32fdb8 SC |
2253 | break ; |
2254 | case verGujarati: | |
44c44c82 | 2255 | lc = wxT("gu_IN") ; |
0e32fdb8 SC |
2256 | break ; |
2257 | case verPunjabi: | |
44c44c82 | 2258 | lc = wxT("pa") ; |
0e32fdb8 SC |
2259 | break ; |
2260 | case verIndiaUrdu: | |
44c44c82 | 2261 | lc = wxT("ur_IN") ; |
0e32fdb8 SC |
2262 | break ; |
2263 | case verVietnam: | |
44c44c82 | 2264 | lc = wxT("vi_VN") ; |
0e32fdb8 SC |
2265 | break ; |
2266 | case verFrBelgium: | |
44c44c82 | 2267 | lc = wxT("fr_BE") ; |
0e32fdb8 SC |
2268 | break ; |
2269 | case verUzbek: | |
44c44c82 | 2270 | lc = wxT("uz_UZ") ; |
0e32fdb8 SC |
2271 | break ; |
2272 | case verSingapore: | |
44c44c82 | 2273 | lc = wxT("zh_SG") ; |
0e32fdb8 SC |
2274 | break ; |
2275 | case verNynorsk: | |
44c44c82 | 2276 | lc = wxT("nn_NO") ; |
0e32fdb8 SC |
2277 | break ; |
2278 | case verAfrikaans: | |
44c44c82 | 2279 | lc = wxT("af_ZA") ; |
0e32fdb8 SC |
2280 | break ; |
2281 | case verEsperanto: | |
44c44c82 | 2282 | lc = wxT("eo") ; |
0e32fdb8 SC |
2283 | break ; |
2284 | case verMarathi: | |
44c44c82 | 2285 | lc = wxT("mr_IN") ; |
0e32fdb8 SC |
2286 | break ; |
2287 | case verTibetan: | |
44c44c82 | 2288 | lc = wxT("bo") ; |
0e32fdb8 SC |
2289 | break ; |
2290 | case verNepal: | |
44c44c82 | 2291 | lc = wxT("ne_NP") ; |
0e32fdb8 SC |
2292 | break ; |
2293 | case verGreenland: | |
44c44c82 | 2294 | lc = wxT("kl_GL") ; |
0e32fdb8 SC |
2295 | break ; |
2296 | default : | |
2297 | break ; | |
2298 | } | |
2299 | for ( i = 0; i < count; i++ ) | |
2300 | { | |
2301 | if ( ms_languagesDB->Item(i).CanonicalName == lc ) | |
2302 | { | |
2303 | break; | |
2304 | } | |
2305 | } | |
9e7ed2b0 | 2306 | |
d3f3e35f VS |
2307 | #elif defined(__WIN32__) |
2308 | LCID lcid = GetUserDefaultLCID(); | |
ec37df57 | 2309 | if ( lcid != 0 ) |
d3f3e35f | 2310 | { |
ec37df57 VZ |
2311 | wxUint32 lang = PRIMARYLANGID(LANGIDFROMLCID(lcid)); |
2312 | wxUint32 sublang = SUBLANGID(LANGIDFROMLCID(lcid)); | |
2313 | ||
2314 | for ( i = 0; i < count; i++ ) | |
d3f3e35f | 2315 | { |
41780009 VS |
2316 | if (ms_languagesDB->Item(i).WinLang == lang && |
2317 | ms_languagesDB->Item(i).WinSublang == sublang) | |
ec37df57 VZ |
2318 | { |
2319 | break; | |
2320 | } | |
d3f3e35f VS |
2321 | } |
2322 | } | |
ec37df57 VZ |
2323 | //else: leave wxlang == wxLANGUAGE_UNKNOWN |
2324 | #endif // Unix/Win32 | |
d3f3e35f | 2325 | |
ec37df57 VZ |
2326 | if ( i < count ) |
2327 | { | |
2328 | // we did find a matching entry, use it | |
41780009 | 2329 | return ms_languagesDB->Item(i).Language; |
ec37df57 | 2330 | } |
d3f3e35f | 2331 | |
ec37df57 VZ |
2332 | // no info about this language in the database |
2333 | return wxLANGUAGE_UNKNOWN; | |
2334 | } | |
d3f3e35f | 2335 | |
dccce9ea VZ |
2336 | // ---------------------------------------------------------------------------- |
2337 | // encoding stuff | |
2338 | // ---------------------------------------------------------------------------- | |
2339 | ||
2340 | // this is a bit strange as under Windows we get the encoding name using its | |
2341 | // numeric value and under Unix we do it the other way round, but this just | |
97626624 | 2342 | // reflects the way different systems provide the encoding info |
dccce9ea VZ |
2343 | |
2344 | /* static */ | |
2345 | wxString wxLocale::GetSystemEncodingName() | |
2346 | { | |
2347 | wxString encname; | |
2348 | ||
c67d6888 | 2349 | #if defined(__WIN32__) && !defined(__WXMICROWIN__) |
dccce9ea VZ |
2350 | // FIXME: what is the error return value for GetACP()? |
2351 | UINT codepage = ::GetACP(); | |
ecffe992 | 2352 | encname.Printf(_T("windows-%u"), codepage); |
1ad48afb SC |
2353 | #elif defined(__WXMAC__) |
2354 | // default is just empty string, this resolves to the default system | |
2355 | // encoding later | |
dccce9ea VZ |
2356 | #elif defined(__UNIX_LIKE__) |
2357 | ||
2358 | #if defined(HAVE_LANGINFO_H) && defined(CODESET) | |
2359 | // GNU libc provides current character set this way (this conforms | |
2360 | // to Unix98) | |
2ec6905c VS |
2361 | char *oldLocale = strdup(setlocale(LC_CTYPE, NULL)); |
2362 | setlocale(LC_CTYPE, ""); | |
f284605f | 2363 | const char *alang = nl_langinfo(CODESET); |
2ec6905c | 2364 | setlocale(LC_CTYPE, oldLocale); |
030c0bea | 2365 | free(oldLocale); |
84f858e9 VZ |
2366 | |
2367 | if ( alang ) | |
dccce9ea | 2368 | { |
09d2016d | 2369 | encname = wxString::FromAscii( alang ); |
dccce9ea | 2370 | } |
09d2016d | 2371 | else // nl_langinfo() failed |
dccce9ea VZ |
2372 | #endif // HAVE_LANGINFO_H |
2373 | { | |
2374 | // if we can't get at the character set directly, try to see if it's in | |
2375 | // the environment variables (in most cases this won't work, but I was | |
2376 | // out of ideas) | |
b1ac3b56 RR |
2377 | char *lang = getenv( "LC_ALL"); |
2378 | char *dot = lang ? strchr(lang, '.') : (char *)NULL; | |
dccce9ea VZ |
2379 | if (!dot) |
2380 | { | |
b1ac3b56 | 2381 | lang = getenv( "LC_CTYPE" ); |
dccce9ea | 2382 | if ( lang ) |
b1ac3b56 | 2383 | dot = strchr(lang, '.' ); |
dccce9ea VZ |
2384 | } |
2385 | if (!dot) | |
2386 | { | |
b1ac3b56 | 2387 | lang = getenv( "LANG"); |
dccce9ea | 2388 | if ( lang ) |
b1ac3b56 | 2389 | dot = strchr(lang, '.'); |
dccce9ea VZ |
2390 | } |
2391 | ||
2392 | if ( dot ) | |
2393 | { | |
b1ac3b56 | 2394 | encname = wxString::FromAscii( dot+1 ); |
dccce9ea VZ |
2395 | } |
2396 | } | |
2397 | #endif // Win32/Unix | |
2398 | ||
2399 | return encname; | |
2400 | } | |
2401 | ||
2402 | /* static */ | |
2403 | wxFontEncoding wxLocale::GetSystemEncoding() | |
2404 | { | |
c67d6888 | 2405 | #if defined(__WIN32__) && !defined(__WXMICROWIN__) |
dccce9ea VZ |
2406 | UINT codepage = ::GetACP(); |
2407 | ||
3c832d58 | 2408 | // wxWidgets only knows about CP1250-1257, 874, 932, 936, 949, 950 |
dccce9ea VZ |
2409 | if ( codepage >= 1250 && codepage <= 1257 ) |
2410 | { | |
2411 | return (wxFontEncoding)(wxFONTENCODING_CP1250 + codepage - 1250); | |
2412 | } | |
c7821f94 | 2413 | |
3c832d58 DS |
2414 | if ( codepage == 874 ) |
2415 | { | |
2416 | return wxFONTENCODING_CP874; | |
2417 | } | |
2418 | ||
c7821f94 VZ |
2419 | if ( codepage == 932 ) |
2420 | { | |
2421 | return wxFONTENCODING_CP932; | |
2422 | } | |
2423 | ||
2424 | if ( codepage == 936 ) | |
2425 | { | |
2426 | return wxFONTENCODING_CP936; | |
2427 | } | |
2428 | ||
2429 | if ( codepage == 949 ) | |
2430 | { | |
2431 | return wxFONTENCODING_CP949; | |
2432 | } | |
2433 | ||
2434 | if ( codepage == 950 ) | |
2435 | { | |
2436 | return wxFONTENCODING_CP950; | |
2437 | } | |
ec79aded | 2438 | #elif defined(__WXMAC__) |
7beb59f3 | 2439 | TextEncoding encoding = 0 ; |
9e687455 | 2440 | #if TARGET_CARBON |
7beb59f3 | 2441 | encoding = CFStringGetSystemEncoding() ; |
9e687455 | 2442 | #else |
7beb59f3 | 2443 | UpgradeScriptInfoToTextEncoding ( smSystemScript , kTextLanguageDontCare , kTextRegionDontCare , NULL , &encoding ) ; |
9e687455 SC |
2444 | #endif |
2445 | return wxMacGetFontEncFromSystemEnc( encoding ) ; | |
1e6feb95 | 2446 | #elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP |
09d2016d | 2447 | const wxString encname = GetSystemEncodingName(); |
dccce9ea VZ |
2448 | if ( !encname.empty() ) |
2449 | { | |
09d2016d | 2450 | wxFontEncoding enc = wxFontMapperBase::GetEncodingFromName(encname); |
9cf28550 | 2451 | |
2b5f62a0 VZ |
2452 | // on some modern Linux systems (RedHat 8) the default system locale |
2453 | // is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so | |
2454 | // don't even try to use it in this case | |
5c7a8a09 | 2455 | #if !wxUSE_UNICODE && (defined(__WXGTK__) || defined(__WXMOTIF__)) |
2b5f62a0 VZ |
2456 | if ( enc == wxFONTENCODING_UTF8 ) |
2457 | { | |
2458 | // the most similar supported encoding... | |
2459 | enc = wxFONTENCODING_ISO8859_1; | |
2460 | } | |
2461 | #endif // !wxUSE_UNICODE | |
2462 | ||
09d2016d VZ |
2463 | // GetEncodingFromName() returns wxFONTENCODING_DEFAULT for C locale |
2464 | // (a.k.a. US-ASCII) which is arguably a bug but keep it like this for | |
2465 | // backwards compatibility and just take care to not return | |
2466 | // wxFONTENCODING_DEFAULT from here as this surely doesn't make sense | |
2467 | if ( enc != wxFONTENCODING_MAX && enc != wxFONTENCODING_DEFAULT ) | |
9cf28550 VZ |
2468 | { |
2469 | return enc; | |
2470 | } | |
2471 | //else: return wxFONTENCODING_SYSTEM below | |
dccce9ea VZ |
2472 | } |
2473 | #endif // Win32/Unix | |
2474 | ||
2475 | return wxFONTENCODING_SYSTEM; | |
2476 | } | |
2477 | ||
14f8fa9d VZ |
2478 | /* static */ |
2479 | void wxLocale::AddLanguage(const wxLanguageInfo& info) | |
d3f3e35f | 2480 | { |
41780009 VS |
2481 | CreateLanguagesDB(); |
2482 | ms_languagesDB->Add(info); | |
d3f3e35f VS |
2483 | } |
2484 | ||
14f8fa9d VZ |
2485 | /* static */ |
2486 | const wxLanguageInfo *wxLocale::GetLanguageInfo(int lang) | |
2487 | { | |
2488 | CreateLanguagesDB(); | |
2489 | ||
f0ab09cc VZ |
2490 | // calling GetLanguageInfo(wxLANGUAGE_DEFAULT) is a natural thing to do, so |
2491 | // make it work | |
2492 | if ( lang == wxLANGUAGE_DEFAULT ) | |
2493 | lang = GetSystemLanguage(); | |
2494 | ||
9d1e1be4 | 2495 | const size_t count = ms_languagesDB->GetCount(); |
14f8fa9d VZ |
2496 | for ( size_t i = 0; i < count; i++ ) |
2497 | { | |
2498 | if ( ms_languagesDB->Item(i).Language == lang ) | |
2499 | { | |
2500 | return &ms_languagesDB->Item(i); | |
2501 | } | |
2502 | } | |
2503 | ||
2504 | return NULL; | |
2505 | } | |
2506 | ||
4a6e4a46 VS |
2507 | /* static */ |
2508 | wxString wxLocale::GetLanguageName(int lang) | |
2509 | { | |
2510 | const wxLanguageInfo *info = GetLanguageInfo(lang); | |
2511 | if ( !info ) | |
2512 | return wxEmptyString; | |
2513 | else | |
2514 | return info->Description; | |
2515 | } | |
2516 | ||
9d1e1be4 VZ |
2517 | /* static */ |
2518 | const wxLanguageInfo *wxLocale::FindLanguageInfo(const wxString& locale) | |
2519 | { | |
2520 | CreateLanguagesDB(); | |
2521 | ||
2522 | const wxLanguageInfo *infoRet = NULL; | |
2523 | ||
2524 | const size_t count = ms_languagesDB->GetCount(); | |
2525 | for ( size_t i = 0; i < count; i++ ) | |
2526 | { | |
2527 | const wxLanguageInfo *info = &ms_languagesDB->Item(i); | |
2528 | ||
2529 | if ( wxStricmp(locale, info->CanonicalName) == 0 || | |
2530 | wxStricmp(locale, info->Description) == 0 ) | |
2531 | { | |
2532 | // exact match, stop searching | |
2533 | infoRet = info; | |
2534 | break; | |
2535 | } | |
2536 | ||
2537 | if ( wxStricmp(locale, info->CanonicalName.BeforeFirst(_T('_'))) == 0 ) | |
2538 | { | |
2539 | // a match -- but maybe we'll find an exact one later, so continue | |
2540 | // looking | |
2541 | // | |
2542 | // OTOH, maybe we had already found a language match and in this | |
2543 | // case don't overwrite it becauce the entry for the default | |
2544 | // country always appears first in ms_languagesDB | |
2545 | if ( !infoRet ) | |
2546 | infoRet = info; | |
2547 | } | |
2548 | } | |
2549 | ||
2550 | return infoRet; | |
2551 | } | |
2552 | ||
d3f3e35f VS |
2553 | wxString wxLocale::GetSysName() const |
2554 | { | |
1c193821 JS |
2555 | // FIXME |
2556 | #ifndef __WXWINCE__ | |
d3f3e35f | 2557 | return wxSetlocale(LC_ALL, NULL); |
1c193821 JS |
2558 | #else |
2559 | return wxEmptyString; | |
2560 | #endif | |
d3f3e35f VS |
2561 | } |
2562 | ||
c801d85f KB |
2563 | // clean up |
2564 | wxLocale::~wxLocale() | |
2565 | { | |
fd323a5e VZ |
2566 | // free memory |
2567 | wxMsgCatalog *pTmpCat; | |
2568 | while ( m_pMsgCat != NULL ) { | |
2569 | pTmpCat = m_pMsgCat; | |
2570 | m_pMsgCat = m_pMsgCat->m_pNext; | |
2571 | delete pTmpCat; | |
2572 | } | |
2573 | ||
eb48778d VZ |
2574 | // restore old locale pointer |
2575 | wxSetLocale(m_pOldLocale); | |
bea561ce | 2576 | |
1c193821 JS |
2577 | // FIXME |
2578 | #ifndef __WXWINCE__ | |
e36e6f95 | 2579 | wxSetlocale(LC_ALL, m_pszOldLocale); |
1c193821 | 2580 | #endif |
10545ca4 | 2581 | free((wxChar *)m_pszOldLocale); // const_cast |
c801d85f KB |
2582 | } |
2583 | ||
2584 | // get the translation of given string in current locale | |
563d535e VS |
2585 | const wxChar *wxLocale::GetString(const wxChar *szOrigString, |
2586 | const wxChar *szDomain) const | |
849a28d0 VS |
2587 | { |
2588 | return GetString(szOrigString, szOrigString, size_t(-1), szDomain); | |
2589 | } | |
2590 | ||
2591 | const wxChar *wxLocale::GetString(const wxChar *szOrigString, | |
2592 | const wxChar *szOrigString2, | |
2593 | size_t n, | |
2594 | const wxChar *szDomain) const | |
c801d85f | 2595 | { |
563d535e | 2596 | if ( wxIsEmpty(szOrigString) ) |
849a28d0 | 2597 | return wxEmptyString; |
c801d85f | 2598 | |
563d535e VS |
2599 | const wxChar *pszTrans = NULL; |
2600 | wxMsgCatalog *pMsgCat; | |
7af89395 | 2601 | |
9e7ed2b0 | 2602 | if ( szDomain != NULL ) |
563d535e VS |
2603 | { |
2604 | pMsgCat = FindCatalog(szDomain); | |
2605 | ||
2606 | // does the catalog exist? | |
2607 | if ( pMsgCat != NULL ) | |
849a28d0 | 2608 | pszTrans = pMsgCat->GetString(szOrigString, n); |
563d535e | 2609 | } |
9e7ed2b0 | 2610 | else |
563d535e VS |
2611 | { |
2612 | // search in all domains | |
9e7ed2b0 | 2613 | for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) |
563d535e | 2614 | { |
849a28d0 | 2615 | pszTrans = pMsgCat->GetString(szOrigString, n); |
563d535e VS |
2616 | if ( pszTrans != NULL ) // take the first found |
2617 | break; | |
2618 | } | |
c801d85f KB |
2619 | } |
2620 | ||
9e7ed2b0 | 2621 | if ( pszTrans == NULL ) |
563d535e VS |
2622 | { |
2623 | #ifdef __WXDEBUG__ | |
9e7ed2b0 | 2624 | if ( !NoTransErr::Suppress() ) |
563d535e VS |
2625 | { |
2626 | NoTransErr noTransErr; | |
e90c1d2a | 2627 | |
6b91d113 VZ |
2628 | wxLogTrace(TRACE_I18N, |
2629 | _T("string \"%s\"[%ld] not found in %slocale '%s'."), | |
2630 | szOrigString, (long)n, | |
2631 | szDomain ? wxString::Format(_T("domain '%s' "), szDomain).c_str() | |
2632 | : _T(""), | |
2633 | m_strLocale.c_str()); | |
563d535e VS |
2634 | } |
2635 | #endif // __WXDEBUG__ | |
12419383 | 2636 | |
849a28d0 VS |
2637 | if (n == size_t(-1)) |
2638 | return szOrigString; | |
2639 | else | |
2640 | return n == 1 ? szOrigString : szOrigString2; | |
563d535e | 2641 | } |
12419383 | 2642 | |
563d535e | 2643 | return pszTrans; |
c801d85f KB |
2644 | } |
2645 | ||
c48908df VZ |
2646 | wxString wxLocale::GetHeaderValue( const wxChar* szHeader, |
2647 | const wxChar* szDomain ) const | |
2648 | { | |
e6bf9573 | 2649 | if ( wxIsEmpty(szHeader) ) |
c48908df VZ |
2650 | return wxEmptyString; |
2651 | ||
2652 | wxChar const * pszTrans = NULL; | |
2653 | wxMsgCatalog *pMsgCat; | |
2654 | ||
2655 | if ( szDomain != NULL ) | |
2656 | { | |
2657 | pMsgCat = FindCatalog(szDomain); | |
2658 | ||
2659 | // does the catalog exist? | |
2660 | if ( pMsgCat == NULL ) | |
2661 | return wxEmptyString; | |
2662 | ||
525d8583 | 2663 | pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); |
c48908df VZ |
2664 | } |
2665 | else | |
2666 | { | |
2667 | // search in all domains | |
2668 | for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) | |
2669 | { | |
525d8583 | 2670 | pszTrans = pMsgCat->GetString(wxEmptyString, (size_t)-1); |
c48908df VZ |
2671 | if ( pszTrans != NULL ) // take the first found |
2672 | break; | |
2673 | } | |
2674 | } | |
2675 | ||
2676 | if ( wxIsEmpty(pszTrans) ) | |
2677 | return wxEmptyString; | |
2678 | ||
e6bf9573 | 2679 | wxChar const * pszFound = wxStrstr(pszTrans, szHeader); |
c48908df VZ |
2680 | if ( pszFound == NULL ) |
2681 | return wxEmptyString; | |
7beb59f3 | 2682 | |
e6bf9573 | 2683 | pszFound += wxStrlen(szHeader) + 2 /* ': ' */; |
c48908df VZ |
2684 | |
2685 | // Every header is separated by \n | |
7beb59f3 | 2686 | |
c48908df VZ |
2687 | wxChar const * pszEndLine = wxStrchr(pszFound, wxT('\n')); |
2688 | if ( pszEndLine == NULL ) pszEndLine = pszFound + wxStrlen(pszFound); | |
2689 | ||
2690 | ||
2691 | // wxString( wxChar*, length); | |
2692 | wxString retVal( pszFound, pszEndLine - pszFound ); | |
2693 | ||
2694 | return retVal; | |
2695 | } | |
2696 | ||
2697 | ||
c801d85f | 2698 | // find catalog by name in a linked list, return NULL if !found |
e36e6f95 | 2699 | wxMsgCatalog *wxLocale::FindCatalog(const wxChar *szDomain) const |
c801d85f | 2700 | { |
563d535e VS |
2701 | // linear search in the linked list |
2702 | wxMsgCatalog *pMsgCat; | |
9e7ed2b0 | 2703 | for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) |
563d535e VS |
2704 | { |
2705 | if ( wxStricmp(pMsgCat->GetName(), szDomain) == 0 ) | |
2706 | return pMsgCat; | |
2707 | } | |
7af89395 | 2708 | |
563d535e | 2709 | return NULL; |
c801d85f KB |
2710 | } |
2711 | ||
2712 | // check if the given catalog is loaded | |
e36e6f95 | 2713 | bool wxLocale::IsLoaded(const wxChar *szDomain) const |
c801d85f KB |
2714 | { |
2715 | return FindCatalog(szDomain) != NULL; | |
2716 | } | |
2717 | ||
2718 | // add a catalog to our linked list | |
e36e6f95 | 2719 | bool wxLocale::AddCatalog(const wxChar *szDomain) |
d721baa9 VS |
2720 | { |
2721 | return AddCatalog(szDomain, wxLANGUAGE_ENGLISH, NULL); | |
2722 | } | |
2723 | ||
2724 | // add a catalog to our linked list | |
2725 | bool wxLocale::AddCatalog(const wxChar *szDomain, | |
2726 | wxLanguage msgIdLanguage, | |
2727 | const wxChar *msgIdCharset) | |
2728 | ||
c801d85f KB |
2729 | { |
2730 | wxMsgCatalog *pMsgCat = new wxMsgCatalog; | |
7af89395 | 2731 | |
d721baa9 | 2732 | if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) ) { |
c801d85f KB |
2733 | // add it to the head of the list so that in GetString it will |
2734 | // be searched before the catalogs added earlier | |
2735 | pMsgCat->m_pNext = m_pMsgCat; | |
2736 | m_pMsgCat = pMsgCat; | |
7af89395 | 2737 | |
d721baa9 | 2738 | return true; |
c801d85f KB |
2739 | } |
2740 | else { | |
2741 | // don't add it because it couldn't be loaded anyway | |
2742 | delete pMsgCat; | |
7af89395 | 2743 | |
d721baa9 VS |
2744 | // It is OK to not load catalog if the msgid language and m_language match, |
2745 | // in which case we can directly display the texts embedded in program's | |
2746 | // source code: | |
2747 | if (m_language == msgIdLanguage) | |
2748 | return true; | |
395a6701 | 2749 | |
d721baa9 VS |
2750 | // If there's no exact match, we may still get partial match where the |
2751 | // (basic) language is same, but the country differs. For example, it's | |
2752 | // permitted to use en_US strings from sources even if m_language is en_GB: | |
2753 | const wxLanguageInfo *msgIdLangInfo = GetLanguageInfo(msgIdLanguage); | |
2754 | if ( msgIdLangInfo && | |
2755 | msgIdLangInfo->CanonicalName.Mid(0, 2) == m_strShort.Mid(0, 2) ) | |
2756 | { | |
2757 | return true; | |
2758 | } | |
2759 | ||
2760 | return false; | |
c801d85f KB |
2761 | } |
2762 | } | |
2763 | ||
cfb20656 VZ |
2764 | // ---------------------------------------------------------------------------- |
2765 | // accessors for locale-dependent data | |
2766 | // ---------------------------------------------------------------------------- | |
2767 | ||
2768 | #ifdef __WXMSW__ | |
2769 | ||
2770 | /* static */ | |
3fe73755 | 2771 | wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) |
cfb20656 VZ |
2772 | { |
2773 | wxString str; | |
2774 | wxChar buffer[256]; | |
2775 | size_t count; | |
2776 | buffer[0] = wxT('\0'); | |
2777 | switch (index) | |
2778 | { | |
60d876f3 | 2779 | case wxLOCALE_DECIMAL_POINT: |
cfb20656 VZ |
2780 | count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256); |
2781 | if (!count) | |
1e8bd6b2 | 2782 | str << wxT("."); |
cfb20656 VZ |
2783 | else |
2784 | str << buffer; | |
2785 | break; | |
60d876f3 | 2786 | #if 0 |
cfb20656 VZ |
2787 | case wxSYS_LIST_SEPARATOR: |
2788 | count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256); | |
2789 | if (!count) | |
1e8bd6b2 | 2790 | str << wxT(","); |
cfb20656 VZ |
2791 | else |
2792 | str << buffer; | |
2793 | break; | |
2794 | case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero | |
2795 | count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, buffer, 256); | |
2796 | if (!count) | |
1e8bd6b2 | 2797 | str << wxT("0"); |
cfb20656 VZ |
2798 | else |
2799 | str << buffer; | |
2800 | break; | |
60d876f3 | 2801 | #endif |
cfb20656 | 2802 | default: |
1e8bd6b2 | 2803 | wxFAIL_MSG(wxT("Unknown System String !")); |
cfb20656 VZ |
2804 | } |
2805 | return str; | |
2806 | } | |
2807 | ||
2808 | #else // !__WXMSW__ | |
2809 | ||
2810 | /* static */ | |
60d876f3 | 2811 | wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) |
cfb20656 | 2812 | { |
60d876f3 SN |
2813 | struct lconv *locale_info = localeconv(); |
2814 | switch (cat) | |
2815 | { | |
2816 | case wxLOCALE_CAT_NUMBER: | |
2817 | switch (index) | |
2818 | { | |
2819 | case wxLOCALE_THOUSANDS_SEP: | |
3fe73755 SN |
2820 | return wxString(locale_info->thousands_sep, |
2821 | *wxConvCurrent); | |
60d876f3 | 2822 | case wxLOCALE_DECIMAL_POINT: |
3fe73755 SN |
2823 | return wxString(locale_info->decimal_point, |
2824 | *wxConvCurrent); | |
60d876f3 SN |
2825 | default: |
2826 | return wxEmptyString; | |
2827 | } | |
2828 | case wxLOCALE_CAT_MONEY: | |
2829 | switch (index) | |
2830 | { | |
2831 | case wxLOCALE_THOUSANDS_SEP: | |
3fe73755 SN |
2832 | return wxString(locale_info->mon_thousands_sep, |
2833 | *wxConvCurrent); | |
60d876f3 | 2834 | case wxLOCALE_DECIMAL_POINT: |
3fe73755 SN |
2835 | return wxString(locale_info->mon_decimal_point, |
2836 | *wxConvCurrent); | |
60d876f3 SN |
2837 | default: |
2838 | return wxEmptyString; | |
2839 | } | |
2840 | default: | |
2841 | return wxEmptyString; | |
2842 | } | |
b7b97e77 | 2843 | } |
cfb20656 VZ |
2844 | |
2845 | #endif // __WXMSW__/!__WXMSW__ | |
2846 | ||
c801d85f KB |
2847 | // ---------------------------------------------------------------------------- |
2848 | // global functions and variables | |
2849 | // ---------------------------------------------------------------------------- | |
2850 | ||
c801d85f KB |
2851 | // retrieve/change current locale |
2852 | // ------------------------------ | |
2853 | ||
2854 | // the current locale object | |
84c18814 | 2855 | static wxLocale *g_pLocale = NULL; |
c801d85f | 2856 | |
1678ad78 GL |
2857 | wxLocale *wxGetLocale() |
2858 | { | |
7af89395 | 2859 | return g_pLocale; |
1678ad78 GL |
2860 | } |
2861 | ||
c801d85f KB |
2862 | wxLocale *wxSetLocale(wxLocale *pLocale) |
2863 | { | |
7af89395 VZ |
2864 | wxLocale *pOld = g_pLocale; |
2865 | g_pLocale = pLocale; | |
2866 | return pOld; | |
c801d85f | 2867 | } |
d427503c | 2868 | |
41780009 VS |
2869 | |
2870 | ||
2871 | // ---------------------------------------------------------------------------- | |
2872 | // wxLocale module (for lazy destruction of languagesDB) | |
2873 | // ---------------------------------------------------------------------------- | |
2874 | ||
2875 | class wxLocaleModule: public wxModule | |
2876 | { | |
2877 | DECLARE_DYNAMIC_CLASS(wxLocaleModule) | |
2878 | public: | |
2879 | wxLocaleModule() {} | |
7beb59f3 | 2880 | bool OnInit() { return true; } |
41780009 VS |
2881 | void OnExit() { wxLocale::DestroyLanguagesDB(); } |
2882 | }; | |
2883 | ||
2884 | IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule) | |
2885 | ||
2886 | ||
2887 | ||
d3f3e35f VS |
2888 | // ---------------------------------------------------------------------------- |
2889 | // default languages table & initialization | |
2890 | // ---------------------------------------------------------------------------- | |
2891 | ||
865a1730 | 2892 | |
41780009 VS |
2893 | |
2894 | // --- --- --- generated code begins here --- --- --- | |
2895 | ||
d3f3e35f VS |
2896 | // This table is generated by misc/languages/genlang.py |
2897 | // When making changes, please put them into misc/languages/langtabl.txt | |
2898 | ||
04ef50df | 2899 | #if !defined(__WIN32__) || defined(__WXMICROWIN__) |
63986ba6 VS |
2900 | |
2901 | #define SETWINLANG(info,lang,sublang) | |
2902 | ||
2903 | #else | |
2904 | ||
d3f3e35f VS |
2905 | #define SETWINLANG(info,lang,sublang) \ |
2906 | info.WinLang = lang, info.WinSublang = sublang; | |
63986ba6 VS |
2907 | |
2908 | #ifndef LANG_AFRIKAANS | |
2909 | #define LANG_AFRIKAANS (0) | |
2910 | #endif | |
2911 | #ifndef LANG_ALBANIAN | |
2912 | #define LANG_ALBANIAN (0) | |
2913 | #endif | |
2914 | #ifndef LANG_ARABIC | |
2915 | #define LANG_ARABIC (0) | |
2916 | #endif | |
2917 | #ifndef LANG_ARMENIAN | |
2918 | #define LANG_ARMENIAN (0) | |
2919 | #endif | |
2920 | #ifndef LANG_ASSAMESE | |
2921 | #define LANG_ASSAMESE (0) | |
2922 | #endif | |
2923 | #ifndef LANG_AZERI | |
2924 | #define LANG_AZERI (0) | |
2925 | #endif | |
2926 | #ifndef LANG_BASQUE | |
2927 | #define LANG_BASQUE (0) | |
2928 | #endif | |
2929 | #ifndef LANG_BELARUSIAN | |
2930 | #define LANG_BELARUSIAN (0) | |
2931 | #endif | |
2932 | #ifndef LANG_BENGALI | |
2933 | #define LANG_BENGALI (0) | |
2934 | #endif | |
2935 | #ifndef LANG_BULGARIAN | |
2936 | #define LANG_BULGARIAN (0) | |
2937 | #endif | |
2938 | #ifndef LANG_CATALAN | |
2939 | #define LANG_CATALAN (0) | |
2940 | #endif | |
2941 | #ifndef LANG_CHINESE | |
2942 | #define LANG_CHINESE (0) | |
2943 | #endif | |
2944 | #ifndef LANG_CROATIAN | |
2945 | #define LANG_CROATIAN (0) | |
2946 | #endif | |
2947 | #ifndef LANG_CZECH | |
2948 | #define LANG_CZECH (0) | |
2949 | #endif | |
2950 | #ifndef LANG_DANISH | |
2951 | #define LANG_DANISH (0) | |
2952 | #endif | |
2953 | #ifndef LANG_DUTCH | |
2954 | #define LANG_DUTCH (0) | |
2955 | #endif | |
2956 | #ifndef LANG_ENGLISH | |
2957 | #define LANG_ENGLISH (0) | |
2958 | #endif | |
2959 | #ifndef LANG_ESTONIAN | |
2960 | #define LANG_ESTONIAN (0) | |
2961 | #endif | |
2962 | #ifndef LANG_FAEROESE | |
2963 | #define LANG_FAEROESE (0) | |
2964 | #endif | |
2965 | #ifndef LANG_FARSI | |
2966 | #define LANG_FARSI (0) | |
2967 | #endif | |
2968 | #ifndef LANG_FINNISH | |
2969 | #define LANG_FINNISH (0) | |
2970 | #endif | |
2971 | #ifndef LANG_FRENCH | |
2972 | #define LANG_FRENCH (0) | |
2973 | #endif | |
2974 | #ifndef LANG_GEORGIAN | |
2975 | #define LANG_GEORGIAN (0) | |
2976 | #endif | |
2977 | #ifndef LANG_GERMAN | |
2978 | #define LANG_GERMAN (0) | |
2979 | #endif | |
2980 | #ifndef LANG_GREEK | |
2981 | #define LANG_GREEK (0) | |
2982 | #endif | |
2983 | #ifndef LANG_GUJARATI | |
2984 | #define LANG_GUJARATI (0) | |
2985 | #endif | |
2986 | #ifndef LANG_HEBREW | |
2987 | #define LANG_HEBREW (0) | |
2988 | #endif | |
2989 | #ifndef LANG_HINDI | |
2990 | #define LANG_HINDI (0) | |
2991 | #endif | |
2992 | #ifndef LANG_HUNGARIAN | |
2993 | #define LANG_HUNGARIAN (0) | |
2994 | #endif | |
2995 | #ifndef LANG_ICELANDIC | |
2996 | #define LANG_ICELANDIC (0) | |
2997 | #endif | |
2998 | #ifndef LANG_INDONESIAN | |
2999 | #define LANG_INDONESIAN (0) | |
3000 | #endif | |
3001 | #ifndef LANG_ITALIAN | |
3002 | #define LANG_ITALIAN (0) | |
3003 | #endif | |
3004 | #ifndef LANG_JAPANESE | |
3005 | #define LANG_JAPANESE (0) | |
3006 | #endif | |
3007 | #ifndef LANG_KANNADA | |
3008 | #define LANG_KANNADA (0) | |
3009 | #endif | |
3010 | #ifndef LANG_KASHMIRI | |
3011 | #define LANG_KASHMIRI (0) | |
3012 | #endif | |
3013 | #ifndef LANG_KAZAK | |
3014 | #define LANG_KAZAK (0) | |
3015 | #endif | |
3016 | #ifndef LANG_KONKANI | |
3017 | #define LANG_KONKANI (0) | |
3018 | #endif | |
3019 | #ifndef LANG_KOREAN | |
3020 | #define LANG_KOREAN (0) | |
3021 | #endif | |
3022 | #ifndef LANG_LATVIAN | |
3023 | #define LANG_LATVIAN (0) | |
3024 | #endif | |
3025 | #ifndef LANG_LITHUANIAN | |
3026 | #define LANG_LITHUANIAN (0) | |
3027 | #endif | |
3028 | #ifndef LANG_MACEDONIAN | |
3029 | #define LANG_MACEDONIAN (0) | |
3030 | #endif | |
3031 | #ifndef LANG_MALAY | |
3032 | #define LANG_MALAY (0) | |
3033 | #endif | |
3034 | #ifndef LANG_MALAYALAM | |
3035 | #define LANG_MALAYALAM (0) | |
3036 | #endif | |
3037 | #ifndef LANG_MANIPURI | |
3038 | #define LANG_MANIPURI (0) | |
3039 | #endif | |
3040 | #ifndef LANG_MARATHI | |
3041 | #define LANG_MARATHI (0) | |
3042 | #endif | |
3043 | #ifndef LANG_NEPALI | |
3044 | #define LANG_NEPALI (0) | |
3045 | #endif | |
3046 | #ifndef LANG_NORWEGIAN | |
3047 | #define LANG_NORWEGIAN (0) | |
3048 | #endif | |
3049 | #ifndef LANG_ORIYA | |
3050 | #define LANG_ORIYA (0) | |
3051 | #endif | |
3052 | #ifndef LANG_POLISH | |
3053 | #define LANG_POLISH (0) | |
3054 | #endif | |
3055 | #ifndef LANG_PORTUGUESE | |
3056 | #define LANG_PORTUGUESE (0) | |
3057 | #endif | |
3058 | #ifndef LANG_PUNJABI | |
3059 | #define LANG_PUNJABI (0) | |
3060 | #endif | |
3061 | #ifndef LANG_ROMANIAN | |
3062 | #define LANG_ROMANIAN (0) | |
3063 | #endif | |
3064 | #ifndef LANG_RUSSIAN | |
3065 | #define LANG_RUSSIAN (0) | |
3066 | #endif | |
3067 | #ifndef LANG_SANSKRIT | |
3068 | #define LANG_SANSKRIT (0) | |
3069 | #endif | |
3070 | #ifndef LANG_SERBIAN | |
3071 | #define LANG_SERBIAN (0) | |
3072 | #endif | |
3073 | #ifndef LANG_SINDHI | |
3074 | #define LANG_SINDHI (0) | |
3075 | #endif | |
3076 | #ifndef LANG_SLOVAK | |
3077 | #define LANG_SLOVAK (0) | |
3078 | #endif | |
3079 | #ifndef LANG_SLOVENIAN | |
3080 | #define LANG_SLOVENIAN (0) | |
3081 | #endif | |
3082 | #ifndef LANG_SPANISH | |
3083 | #define LANG_SPANISH (0) | |
3084 | #endif | |
3085 | #ifndef LANG_SWAHILI | |
3086 | #define LANG_SWAHILI (0) | |
3087 | #endif | |
3088 | #ifndef LANG_SWEDISH | |
3089 | #define LANG_SWEDISH (0) | |
3090 | #endif | |
3091 | #ifndef LANG_TAMIL | |
3092 | #define LANG_TAMIL (0) | |
3093 | #endif | |
3094 | #ifndef LANG_TATAR | |
3095 | #define LANG_TATAR (0) | |
3096 | #endif | |
3097 | #ifndef LANG_TELUGU | |
3098 | #define LANG_TELUGU (0) | |
3099 | #endif | |
3100 | #ifndef LANG_THAI | |
3101 | #define LANG_THAI (0) | |
3102 | #endif | |
3103 | #ifndef LANG_TURKISH | |
3104 | #define LANG_TURKISH (0) | |
3105 | #endif | |
3106 | #ifndef LANG_UKRAINIAN | |
3107 | #define LANG_UKRAINIAN (0) | |
3108 | #endif | |
3109 | #ifndef LANG_URDU | |
3110 | #define LANG_URDU (0) | |
3111 | #endif | |
3112 | #ifndef LANG_UZBEK | |
3113 | #define LANG_UZBEK (0) | |
3114 | #endif | |
3115 | #ifndef LANG_VIETNAMESE | |
3116 | #define LANG_VIETNAMESE (0) | |
3117 | #endif | |
3118 | #ifndef SUBLANG_ARABIC_ALGERIA | |
3119 | #define SUBLANG_ARABIC_ALGERIA SUBLANG_DEFAULT | |
3120 | #endif | |
3121 | #ifndef SUBLANG_ARABIC_BAHRAIN | |
3122 | #define SUBLANG_ARABIC_BAHRAIN SUBLANG_DEFAULT | |
3123 | #endif | |
3124 | #ifndef SUBLANG_ARABIC_EGYPT | |
3125 | #define SUBLANG_ARABIC_EGYPT SUBLANG_DEFAULT | |
3126 | #endif | |
3127 | #ifndef SUBLANG_ARABIC_IRAQ | |
3128 | #define SUBLANG_ARABIC_IRAQ SUBLANG_DEFAULT | |
3129 | #endif | |
3130 | #ifndef SUBLANG_ARABIC_JORDAN | |
3131 | #define SUBLANG_ARABIC_JORDAN SUBLANG_DEFAULT | |
3132 | #endif | |
3133 | #ifndef SUBLANG_ARABIC_KUWAIT | |
3134 | #define SUBLANG_ARABIC_KUWAIT SUBLANG_DEFAULT | |
3135 | #endif | |
3136 | #ifndef SUBLANG_ARABIC_LEBANON | |
3137 | #define SUBLANG_ARABIC_LEBANON SUBLANG_DEFAULT | |
3138 | #endif | |
3139 | #ifndef SUBLANG_ARABIC_LIBYA | |
3140 | #define SUBLANG_ARABIC_LIBYA SUBLANG_DEFAULT | |
3141 | #endif | |
3142 | #ifndef SUBLANG_ARABIC_MOROCCO | |
3143 | #define SUBLANG_ARABIC_MOROCCO SUBLANG_DEFAULT | |
3144 | #endif | |
3145 | #ifndef SUBLANG_ARABIC_OMAN | |
3146 | #define SUBLANG_ARABIC_OMAN SUBLANG_DEFAULT | |
3147 | #endif | |
3148 | #ifndef SUBLANG_ARABIC_QATAR | |
3149 | #define SUBLANG_ARABIC_QATAR SUBLANG_DEFAULT | |
3150 | #endif | |
3151 | #ifndef SUBLANG_ARABIC_SAUDI_ARABIA | |
3152 | #define SUBLANG_ARABIC_SAUDI_ARABIA SUBLANG_DEFAULT | |
3153 | #endif | |
3154 | #ifndef SUBLANG_ARABIC_SYRIA | |
3155 | #define SUBLANG_ARABIC_SYRIA SUBLANG_DEFAULT | |
3156 | #endif | |
3157 | #ifndef SUBLANG_ARABIC_TUNISIA | |
3158 | #define SUBLANG_ARABIC_TUNISIA SUBLANG_DEFAULT | |
3159 | #endif | |
3160 | #ifndef SUBLANG_ARABIC_UAE | |
3161 | #define SUBLANG_ARABIC_UAE SUBLANG_DEFAULT | |
3162 | #endif | |
3163 | #ifndef SUBLANG_ARABIC_YEMEN | |
3164 | #define SUBLANG_ARABIC_YEMEN SUBLANG_DEFAULT | |
3165 | #endif | |
3166 | #ifndef SUBLANG_AZERI_CYRILLIC | |
3167 | #define SUBLANG_AZERI_CYRILLIC SUBLANG_DEFAULT | |
3168 | #endif | |
3169 | #ifndef SUBLANG_AZERI_LATIN | |
3170 | #define SUBLANG_AZERI_LATIN SUBLANG_DEFAULT | |
3171 | #endif | |
3172 | #ifndef SUBLANG_CHINESE_SIMPLIFIED | |
3173 | #define SUBLANG_CHINESE_SIMPLIFIED SUBLANG_DEFAULT | |
3174 | #endif | |
3175 | #ifndef SUBLANG_CHINESE_TRADITIONAL | |
3176 | #define SUBLANG_CHINESE_TRADITIONAL SUBLANG_DEFAULT | |
3177 | #endif | |
3178 | #ifndef SUBLANG_CHINESE_HONGKONG | |
3179 | #define SUBLANG_CHINESE_HONGKONG SUBLANG_DEFAULT | |
3180 | #endif | |
3181 | #ifndef SUBLANG_CHINESE_MACAU | |
3182 | #define SUBLANG_CHINESE_MACAU SUBLANG_DEFAULT | |
3183 | #endif | |
3184 | #ifndef SUBLANG_CHINESE_SINGAPORE | |
3185 | #define SUBLANG_CHINESE_SINGAPORE SUBLANG_DEFAULT | |
3186 | #endif | |
3187 | #ifndef SUBLANG_DUTCH | |
3188 | #define SUBLANG_DUTCH SUBLANG_DEFAULT | |
3189 | #endif | |
3190 | #ifndef SUBLANG_DUTCH_BELGIAN | |
3191 | #define SUBLANG_DUTCH_BELGIAN SUBLANG_DEFAULT | |
3192 | #endif | |
3193 | #ifndef SUBLANG_ENGLISH_UK | |
3194 | #define SUBLANG_ENGLISH_UK SUBLANG_DEFAULT | |
3195 | #endif | |
3196 | #ifndef SUBLANG_ENGLISH_US | |
3197 | #define SUBLANG_ENGLISH_US SUBLANG_DEFAULT | |
3198 | #endif | |
3199 | #ifndef SUBLANG_ENGLISH_AUS | |
3200 | #define SUBLANG_ENGLISH_AUS SUBLANG_DEFAULT | |
3201 | #endif | |
3202 | #ifndef SUBLANG_ENGLISH_BELIZE | |
3203 | #define SUBLANG_ENGLISH_BELIZE SUBLANG_DEFAULT | |
3204 | #endif | |
3205 | #ifndef SUBLANG_ENGLISH_CAN | |
3206 | #define SUBLANG_ENGLISH_CAN SUBLANG_DEFAULT | |
3207 | #endif | |
3208 | #ifndef SUBLANG_ENGLISH_CARIBBEAN | |
3209 | #define SUBLANG_ENGLISH_CARIBBEAN SUBLANG_DEFAULT | |
3210 | #endif | |
3211 | #ifndef SUBLANG_ENGLISH_EIRE | |
3212 | #define SUBLANG_ENGLISH_EIRE SUBLANG_DEFAULT | |
3213 | #endif | |
3214 | #ifndef SUBLANG_ENGLISH_JAMAICA | |
3215 | #define SUBLANG_ENGLISH_JAMAICA SUBLANG_DEFAULT | |
3216 | #endif | |
3217 | #ifndef SUBLANG_ENGLISH_NZ | |
3218 | #define SUBLANG_ENGLISH_NZ SUBLANG_DEFAULT | |
3219 | #endif | |
3220 | #ifndef SUBLANG_ENGLISH_PHILIPPINES | |
3221 | #define SUBLANG_ENGLISH_PHILIPPINES SUBLANG_DEFAULT | |
3222 | #endif | |
3223 | #ifndef SUBLANG_ENGLISH_SOUTH_AFRICA | |
3224 | #define SUBLANG_ENGLISH_SOUTH_AFRICA SUBLANG_DEFAULT | |
3225 | #endif | |
3226 | #ifndef SUBLANG_ENGLISH_TRINIDAD | |
3227 | #define SUBLANG_ENGLISH_TRINIDAD SUBLANG_DEFAULT | |
3228 | #endif | |
3229 | #ifndef SUBLANG_ENGLISH_ZIMBABWE | |
3230 | #define SUBLANG_ENGLISH_ZIMBABWE SUBLANG_DEFAULT | |
3231 | #endif | |
3232 | #ifndef SUBLANG_FRENCH | |
3233 | #define SUBLANG_FRENCH SUBLANG_DEFAULT | |
3234 | #endif | |
3235 | #ifndef SUBLANG_FRENCH_BELGIAN | |
3236 | #define SUBLANG_FRENCH_BELGIAN SUBLANG_DEFAULT | |
3237 | #endif | |
3238 | #ifndef SUBLANG_FRENCH_CANADIAN | |
3239 | #define SUBLANG_FRENCH_CANADIAN SUBLANG_DEFAULT | |
3240 | #endif | |
3241 | #ifndef SUBLANG_FRENCH_LUXEMBOURG | |
3242 | #define SUBLANG_FRENCH_LUXEMBOURG SUBLANG_DEFAULT | |
3243 | #endif | |
3244 | #ifndef SUBLANG_FRENCH_MONACO | |
3245 | #define SUBLANG_FRENCH_MONACO SUBLANG_DEFAULT | |
3246 | #endif | |
3247 | #ifndef SUBLANG_FRENCH_SWISS | |
3248 | #define SUBLANG_FRENCH_SWISS SUBLANG_DEFAULT | |
3249 | #endif | |
3250 | #ifndef SUBLANG_GERMAN | |
3251 | #define SUBLANG_GERMAN SUBLANG_DEFAULT | |
3252 | #endif | |
3253 | #ifndef SUBLANG_GERMAN_AUSTRIAN | |
3254 | #define SUBLANG_GERMAN_AUSTRIAN SUBLANG_DEFAULT | |
3255 | #endif | |
3256 | #ifndef SUBLANG_GERMAN_LIECHTENSTEIN | |
3257 | #define SUBLANG_GERMAN_LIECHTENSTEIN SUBLANG_DEFAULT | |
3258 | #endif | |
3259 | #ifndef SUBLANG_GERMAN_LUXEMBOURG | |
3260 | #define SUBLANG_GERMAN_LUXEMBOURG SUBLANG_DEFAULT | |
3261 | #endif | |
3262 | #ifndef SUBLANG_GERMAN_SWISS | |
3263 | #define SUBLANG_GERMAN_SWISS SUBLANG_DEFAULT | |
3264 | #endif | |
3265 | #ifndef SUBLANG_ITALIAN | |
3266 | #define SUBLANG_ITALIAN SUBLANG_DEFAULT | |
3267 | #endif | |
3268 | #ifndef SUBLANG_ITALIAN_SWISS | |
3269 | #define SUBLANG_ITALIAN_SWISS SUBLANG_DEFAULT | |
3270 | #endif | |
3271 | #ifndef SUBLANG_KASHMIRI_INDIA | |
3272 | #define SUBLANG_KASHMIRI_INDIA SUBLANG_DEFAULT | |
3273 | #endif | |
3274 | #ifndef SUBLANG_KOREAN | |
3275 | #define SUBLANG_KOREAN SUBLANG_DEFAULT | |
3276 | #endif | |
3277 | #ifndef SUBLANG_LITHUANIAN | |
3278 | #define SUBLANG_LITHUANIAN SUBLANG_DEFAULT | |
3279 | #endif | |
3280 | #ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM | |
3281 | #define SUBLANG_MALAY_BRUNEI_DARUSSALAM SUBLANG_DEFAULT | |
3282 | #endif | |
3283 | #ifndef SUBLANG_MALAY_MALAYSIA | |
3284 | #define SUBLANG_MALAY_MALAYSIA SUBLANG_DEFAULT | |
3285 | #endif | |
3286 | #ifndef SUBLANG_NEPALI_INDIA | |
3287 | #define SUBLANG_NEPALI_INDIA SUBLANG_DEFAULT | |
3288 | #endif | |
3289 | #ifndef SUBLANG_NORWEGIAN_BOKMAL | |
3290 | #define SUBLANG_NORWEGIAN_BOKMAL SUBLANG_DEFAULT | |
3291 | #endif | |
3292 | #ifndef SUBLANG_NORWEGIAN_NYNORSK | |
3293 | #define SUBLANG_NORWEGIAN_NYNORSK SUBLANG_DEFAULT | |
3294 | #endif | |
3295 | #ifndef SUBLANG_PORTUGUESE | |
3296 | #define SUBLANG_PORTUGUESE SUBLANG_DEFAULT | |
3297 | #endif | |
3298 | #ifndef SUBLANG_PORTUGUESE_BRAZILIAN | |
3299 | #define SUBLANG_PORTUGUESE_BRAZILIAN SUBLANG_DEFAULT | |
3300 | #endif | |
3301 | #ifndef SUBLANG_SERBIAN_CYRILLIC | |
3302 | #define SUBLANG_SERBIAN_CYRILLIC SUBLANG_DEFAULT | |
3303 | #endif | |
3304 | #ifndef SUBLANG_SERBIAN_LATIN | |
3305 | #define SUBLANG_SERBIAN_LATIN SUBLANG_DEFAULT | |
3306 | #endif | |
3307 | #ifndef SUBLANG_SPANISH | |
3308 | #define SUBLANG_SPANISH SUBLANG_DEFAULT | |
3309 | #endif | |
3310 | #ifndef SUBLANG_SPANISH_ARGENTINA | |
3311 | #define SUBLANG_SPANISH_ARGENTINA SUBLANG_DEFAULT | |
3312 | #endif | |
3313 | #ifndef SUBLANG_SPANISH_BOLIVIA | |
3314 | #define SUBLANG_SPANISH_BOLIVIA SUBLANG_DEFAULT | |
3315 | #endif | |
3316 | #ifndef SUBLANG_SPANISH_CHILE | |
3317 | #define SUBLANG_SPANISH_CHILE SUBLANG_DEFAULT | |
3318 | #endif | |
3319 | #ifndef SUBLANG_SPANISH_COLOMBIA | |
3320 | #define SUBLANG_SPANISH_COLOMBIA SUBLANG_DEFAULT | |
3321 | #endif | |
3322 | #ifndef SUBLANG_SPANISH_COSTA_RICA | |
3323 | #define SUBLANG_SPANISH_COSTA_RICA SUBLANG_DEFAULT | |
3324 | #endif | |
3325 | #ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC | |
3326 | #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC SUBLANG_DEFAULT | |
3327 | #endif | |
3328 | #ifndef SUBLANG_SPANISH_ECUADOR | |
3329 | #define SUBLANG_SPANISH_ECUADOR SUBLANG_DEFAULT | |
3330 | #endif | |
3331 | #ifndef SUBLANG_SPANISH_EL_SALVADOR | |
3332 | #define SUBLANG_SPANISH_EL_SALVADOR SUBLANG_DEFAULT | |
3333 | #endif | |
3334 | #ifndef SUBLANG_SPANISH_GUATEMALA | |
3335 | #define SUBLANG_SPANISH_GUATEMALA SUBLANG_DEFAULT | |
3336 | #endif | |
3337 | #ifndef SUBLANG_SPANISH_HONDURAS | |
3338 | #define SUBLANG_SPANISH_HONDURAS SUBLANG_DEFAULT | |
3339 | #endif | |
3340 | #ifndef SUBLANG_SPANISH_MEXICAN | |
3341 | #define SUBLANG_SPANISH_MEXICAN SUBLANG_DEFAULT | |
3342 | #endif | |
3343 | #ifndef SUBLANG_SPANISH_MODERN | |
3344 | #define SUBLANG_SPANISH_MODERN SUBLANG_DEFAULT | |
3345 | #endif | |
3346 | #ifndef SUBLANG_SPANISH_NICARAGUA | |
3347 | #define SUBLANG_SPANISH_NICARAGUA SUBLANG_DEFAULT | |
3348 | #endif | |
3349 | #ifndef SUBLANG_SPANISH_PANAMA | |
3350 | #define SUBLANG_SPANISH_PANAMA SUBLANG_DEFAULT | |
3351 | #endif | |
3352 | #ifndef SUBLANG_SPANISH_PARAGUAY | |
3353 | #define SUBLANG_SPANISH_PARAGUAY SUBLANG_DEFAULT | |
3354 | #endif | |
3355 | #ifndef SUBLANG_SPANISH_PERU | |
3356 | #define SUBLANG_SPANISH_PERU SUBLANG_DEFAULT | |
3357 | #endif | |
3358 | #ifndef SUBLANG_SPANISH_PUERTO_RICO | |
3359 | #define SUBLANG_SPANISH_PUERTO_RICO SUBLANG_DEFAULT | |
3360 | #endif | |
3361 | #ifndef SUBLANG_SPANISH_URUGUAY | |
3362 | #define SUBLANG_SPANISH_URUGUAY SUBLANG_DEFAULT | |
3363 | #endif | |
3364 | #ifndef SUBLANG_SPANISH_VENEZUELA | |
3365 | #define SUBLANG_SPANISH_VENEZUELA SUBLANG_DEFAULT | |
3366 | #endif | |
3367 | #ifndef SUBLANG_SWEDISH | |
3368 | #define SUBLANG_SWEDISH SUBLANG_DEFAULT | |
3369 | #endif | |
3370 | #ifndef SUBLANG_SWEDISH_FINLAND | |
3371 | #define SUBLANG_SWEDISH_FINLAND SUBLANG_DEFAULT | |
3372 | #endif | |
3373 | #ifndef SUBLANG_URDU_INDIA | |
3374 | #define SUBLANG_URDU_INDIA SUBLANG_DEFAULT | |
3375 | #endif | |
3376 | #ifndef SUBLANG_URDU_PAKISTAN | |
3377 | #define SUBLANG_URDU_PAKISTAN SUBLANG_DEFAULT | |
3378 | #endif | |
3379 | #ifndef SUBLANG_UZBEK_CYRILLIC | |
3380 | #define SUBLANG_UZBEK_CYRILLIC SUBLANG_DEFAULT | |
3381 | #endif | |
3382 | #ifndef SUBLANG_UZBEK_LATIN | |
3383 | #define SUBLANG_UZBEK_LATIN SUBLANG_DEFAULT | |
d3f3e35f VS |
3384 | #endif |
3385 | ||
63986ba6 VS |
3386 | |
3387 | #endif // __WIN32__ | |
3388 | ||
d3f3e35f VS |
3389 | #define LNG(wxlang, canonical, winlang, winsublang, desc) \ |
3390 | info.Language = wxlang; \ | |
3391 | info.CanonicalName = wxT(canonical); \ | |
2b5f62a0 | 3392 | info.Description = wxT(desc); \ |
d3f3e35f VS |
3393 | SETWINLANG(info, winlang, winsublang) \ |
3394 | AddLanguage(info); | |
3395 | ||
3396 | void wxLocale::InitLanguagesDB() | |
3397 | { | |
3398 | wxLanguageInfo info; | |
3399 | wxStringTokenizer tkn; | |
63986ba6 | 3400 | |
14f8fa9d | 3401 | LNG(wxLANGUAGE_ABKHAZIAN, "ab" , 0 , 0 , "Abkhazian") |
d3f3e35f VS |
3402 | LNG(wxLANGUAGE_AFAR, "aa" , 0 , 0 , "Afar") |
3403 | LNG(wxLANGUAGE_AFRIKAANS, "af_ZA", LANG_AFRIKAANS , SUBLANG_DEFAULT , "Afrikaans") | |
3404 | LNG(wxLANGUAGE_ALBANIAN, "sq_AL", LANG_ALBANIAN , SUBLANG_DEFAULT , "Albanian") | |
3405 | LNG(wxLANGUAGE_AMHARIC, "am" , 0 , 0 , "Amharic") | |
3406 | LNG(wxLANGUAGE_ARABIC, "ar" , LANG_ARABIC , SUBLANG_DEFAULT , "Arabic") | |
3407 | LNG(wxLANGUAGE_ARABIC_ALGERIA, "ar_DZ", LANG_ARABIC , SUBLANG_ARABIC_ALGERIA , "Arabic (Algeria)") | |
3408 | LNG(wxLANGUAGE_ARABIC_BAHRAIN, "ar_BH", LANG_ARABIC , SUBLANG_ARABIC_BAHRAIN , "Arabic (Bahrain)") | |
3409 | LNG(wxLANGUAGE_ARABIC_EGYPT, "ar_EG", LANG_ARABIC , SUBLANG_ARABIC_EGYPT , "Arabic (Egypt)") | |
3410 | LNG(wxLANGUAGE_ARABIC_IRAQ, "ar_IQ", LANG_ARABIC , SUBLANG_ARABIC_IRAQ , "Arabic (Iraq)") | |
3411 | LNG(wxLANGUAGE_ARABIC_JORDAN, "ar_JO", LANG_ARABIC , SUBLANG_ARABIC_JORDAN , "Arabic (Jordan)") | |
3412 | LNG(wxLANGUAGE_ARABIC_KUWAIT, "ar_KW", LANG_ARABIC , SUBLANG_ARABIC_KUWAIT , "Arabic (Kuwait)") | |
3413 | LNG(wxLANGUAGE_ARABIC_LEBANON, "ar_LB", LANG_ARABIC , SUBLANG_ARABIC_LEBANON , "Arabic (Lebanon)") | |
3414 | LNG(wxLANGUAGE_ARABIC_LIBYA, "ar_LY", LANG_ARABIC , SUBLANG_ARABIC_LIBYA , "Arabic (Libya)") | |
3415 | LNG(wxLANGUAGE_ARABIC_MOROCCO, "ar_MA", LANG_ARABIC , SUBLANG_ARABIC_MOROCCO , "Arabic (Morocco)") | |
3416 | LNG(wxLANGUAGE_ARABIC_OMAN, "ar_OM", LANG_ARABIC , SUBLANG_ARABIC_OMAN , "Arabic (Oman)") | |
3417 | LNG(wxLANGUAGE_ARABIC_QATAR, "ar_QA", LANG_ARABIC , SUBLANG_ARABIC_QATAR , "Arabic (Qatar)") | |
3418 | LNG(wxLANGUAGE_ARABIC_SAUDI_ARABIA, "ar_SA", LANG_ARABIC , SUBLANG_ARABIC_SAUDI_ARABIA , "Arabic (Saudi Arabia)") | |
3419 | LNG(wxLANGUAGE_ARABIC_SUDAN, "ar_SD", 0 , 0 , "Arabic (Sudan)") | |
3420 | LNG(wxLANGUAGE_ARABIC_SYRIA, "ar_SY", LANG_ARABIC , SUBLANG_ARABIC_SYRIA , "Arabic (Syria)") | |
3421 | LNG(wxLANGUAGE_ARABIC_TUNISIA, "ar_TN", LANG_ARABIC , SUBLANG_ARABIC_TUNISIA , "Arabic (Tunisia)") | |
3422 | LNG(wxLANGUAGE_ARABIC_UAE, "ar_AE", LANG_ARABIC , SUBLANG_ARABIC_UAE , "Arabic (Uae)") | |
3423 | LNG(wxLANGUAGE_ARABIC_YEMEN, "ar_YE", LANG_ARABIC , SUBLANG_ARABIC_YEMEN , "Arabic (Yemen)") | |
3424 | LNG(wxLANGUAGE_ARMENIAN, "hy" , LANG_ARMENIAN , SUBLANG_DEFAULT , "Armenian") | |
3425 | LNG(wxLANGUAGE_ASSAMESE, "as" , LANG_ASSAMESE , SUBLANG_DEFAULT , "Assamese") | |
3426 | LNG(wxLANGUAGE_AYMARA, "ay" , 0 , 0 , "Aymara") | |
3427 | LNG(wxLANGUAGE_AZERI, "az" , LANG_AZERI , SUBLANG_DEFAULT , "Azeri") | |
3428 | LNG(wxLANGUAGE_AZERI_CYRILLIC, "az" , LANG_AZERI , SUBLANG_AZERI_CYRILLIC , "Azeri (Cyrillic)") | |
3429 | LNG(wxLANGUAGE_AZERI_LATIN, "az" , LANG_AZERI , SUBLANG_AZERI_LATIN , "Azeri (Latin)") | |
3430 | LNG(wxLANGUAGE_BASHKIR, "ba" , 0 , 0 , "Bashkir") | |
3431 | LNG(wxLANGUAGE_BASQUE, "eu_ES", LANG_BASQUE , SUBLANG_DEFAULT , "Basque") | |
3432 | LNG(wxLANGUAGE_BELARUSIAN, "be_BY", LANG_BELARUSIAN, SUBLANG_DEFAULT , "Belarusian") | |
3433 | LNG(wxLANGUAGE_BENGALI, "bn" , LANG_BENGALI , SUBLANG_DEFAULT , "Bengali") | |
3434 | LNG(wxLANGUAGE_BHUTANI, "dz" , 0 , 0 , "Bhutani") | |
3435 | LNG(wxLANGUAGE_BIHARI, "bh" , 0 , 0 , "Bihari") | |
3436 | LNG(wxLANGUAGE_BISLAMA, "bi" , 0 , 0 , "Bislama") | |
3437 | LNG(wxLANGUAGE_BRETON, "br" , 0 , 0 , "Breton") | |
3438 | LNG(wxLANGUAGE_BULGARIAN, "bg_BG", LANG_BULGARIAN , SUBLANG_DEFAULT , "Bulgarian") | |
3439 | LNG(wxLANGUAGE_BURMESE, "my" , 0 , 0 , "Burmese") | |
3440 | LNG(wxLANGUAGE_CAMBODIAN, "km" , 0 , 0 , "Cambodian") | |
3441 | LNG(wxLANGUAGE_CATALAN, "ca_ES", LANG_CATALAN , SUBLANG_DEFAULT , "Catalan") | |
e6cea1d3 | 3442 | LNG(wxLANGUAGE_CHINESE, "zh_TW", LANG_CHINESE , SUBLANG_DEFAULT , "Chinese") |
d3f3e35f | 3443 | LNG(wxLANGUAGE_CHINESE_SIMPLIFIED, "zh_CN", LANG_CHINESE , SUBLANG_CHINESE_SIMPLIFIED , "Chinese (Simplified)") |
3ebd765d | 3444 | LNG(wxLANGUAGE_CHINESE_TRADITIONAL, "zh_TW", LANG_CHINESE , SUBLANG_CHINESE_TRADITIONAL , "Chinese (Traditional)") |
d3f3e35f VS |
3445 | LNG(wxLANGUAGE_CHINESE_HONGKONG, "zh_HK", LANG_CHINESE , SUBLANG_CHINESE_HONGKONG , "Chinese (Hongkong)") |
3446 | LNG(wxLANGUAGE_CHINESE_MACAU, "zh_MO", LANG_CHINESE , SUBLANG_CHINESE_MACAU , "Chinese (Macau)") | |
3447 | LNG(wxLANGUAGE_CHINESE_SINGAPORE, "zh_SG", LANG_CHINESE , SUBLANG_CHINESE_SINGAPORE , "Chinese (Singapore)") | |
2b5f62a0 | 3448 | LNG(wxLANGUAGE_CHINESE_TAIWAN, "zh_TW", LANG_CHINESE , SUBLANG_CHINESE_TRADITIONAL , "Chinese (Taiwan)") |
d3f3e35f VS |
3449 | LNG(wxLANGUAGE_CORSICAN, "co" , 0 , 0 , "Corsican") |
3450 | LNG(wxLANGUAGE_CROATIAN, "hr_HR", LANG_CROATIAN , SUBLANG_DEFAULT , "Croatian") | |
3451 | LNG(wxLANGUAGE_CZECH, "cs_CZ", LANG_CZECH , SUBLANG_DEFAULT , "Czech") | |
3452 | LNG(wxLANGUAGE_DANISH, "da_DK", LANG_DANISH , SUBLANG_DEFAULT , "Danish") | |
3453 | LNG(wxLANGUAGE_DUTCH, "nl_NL", LANG_DUTCH , SUBLANG_DUTCH , "Dutch") | |
3454 | LNG(wxLANGUAGE_DUTCH_BELGIAN, "nl_BE", LANG_DUTCH , SUBLANG_DUTCH_BELGIAN , "Dutch (Belgian)") | |
3455 | LNG(wxLANGUAGE_ENGLISH, "en_GB", LANG_ENGLISH , SUBLANG_ENGLISH_UK , "English") | |
3456 | LNG(wxLANGUAGE_ENGLISH_UK, "en_GB", LANG_ENGLISH , SUBLANG_ENGLISH_UK , "English (U.K.)") | |
3457 | LNG(wxLANGUAGE_ENGLISH_US, "en_US", LANG_ENGLISH , SUBLANG_ENGLISH_US , "English (U.S.)") | |
3458 | LNG(wxLANGUAGE_ENGLISH_AUSTRALIA, "en_AU", LANG_ENGLISH , SUBLANG_ENGLISH_AUS , "English (Australia)") | |
3459 | LNG(wxLANGUAGE_ENGLISH_BELIZE, "en_BZ", LANG_ENGLISH , SUBLANG_ENGLISH_BELIZE , "English (Belize)") | |
3460 | LNG(wxLANGUAGE_ENGLISH_BOTSWANA, "en_BW", 0 , 0 , "English (Botswana)") | |
3461 | LNG(wxLANGUAGE_ENGLISH_CANADA, "en_CA", LANG_ENGLISH , SUBLANG_ENGLISH_CAN , "English (Canada)") | |
3462 | LNG(wxLANGUAGE_ENGLISH_CARIBBEAN, "en_CB", LANG_ENGLISH , SUBLANG_ENGLISH_CARIBBEAN , "English (Caribbean)") | |
3463 | LNG(wxLANGUAGE_ENGLISH_DENMARK, "en_DK", 0 , 0 , "English (Denmark)") | |
3464 | LNG(wxLANGUAGE_ENGLISH_EIRE, "en_IE", LANG_ENGLISH , SUBLANG_ENGLISH_EIRE , "English (Eire)") | |
3465 | LNG(wxLANGUAGE_ENGLISH_JAMAICA, "en_JM", LANG_ENGLISH , SUBLANG_ENGLISH_JAMAICA , "English (Jamaica)") | |
3466 | LNG(wxLANGUAGE_ENGLISH_NEW_ZEALAND, "en_NZ", LANG_ENGLISH , SUBLANG_ENGLISH_NZ , "English (New Zealand)") | |
3467 | LNG(wxLANGUAGE_ENGLISH_PHILIPPINES, "en_PH", LANG_ENGLISH , SUBLANG_ENGLISH_PHILIPPINES , "English (Philippines)") | |
3468 | LNG(wxLANGUAGE_ENGLISH_SOUTH_AFRICA, "en_ZA", LANG_ENGLISH , SUBLANG_ENGLISH_SOUTH_AFRICA , "English (South Africa)") | |
3469 | LNG(wxLANGUAGE_ENGLISH_TRINIDAD, "en_TT", LANG_ENGLISH , SUBLANG_ENGLISH_TRINIDAD , "English (Trinidad)") | |
3470 | LNG(wxLANGUAGE_ENGLISH_ZIMBABWE, "en_ZW", LANG_ENGLISH , SUBLANG_ENGLISH_ZIMBABWE , "English (Zimbabwe)") | |
3471 | LNG(wxLANGUAGE_ESPERANTO, "eo" , 0 , 0 , "Esperanto") | |
3472 | LNG(wxLANGUAGE_ESTONIAN, "et_EE", LANG_ESTONIAN , SUBLANG_DEFAULT , "Estonian") | |
3473 | LNG(wxLANGUAGE_FAEROESE, "fo_FO", LANG_FAEROESE , SUBLANG_DEFAULT , "Faeroese") | |
865a1730 | 3474 | LNG(wxLANGUAGE_FARSI, "fa_IR", LANG_FARSI , SUBLANG_DEFAULT , "Farsi") |
d3f3e35f VS |
3475 | LNG(wxLANGUAGE_FIJI, "fj" , 0 , 0 , "Fiji") |
3476 | LNG(wxLANGUAGE_FINNISH, "fi_FI", LANG_FINNISH , SUBLANG_DEFAULT , "Finnish") | |
3477 | LNG(wxLANGUAGE_FRENCH, "fr_FR", LANG_FRENCH , SUBLANG_FRENCH , "French") | |
3478 | LNG(wxLANGUAGE_FRENCH_BELGIAN, "fr_BE", LANG_FRENCH , SUBLANG_FRENCH_BELGIAN , "French (Belgian)") | |
3479 | LNG(wxLANGUAGE_FRENCH_CANADIAN, "fr_CA", LANG_FRENCH , SUBLANG_FRENCH_CANADIAN , "French (Canadian)") | |
3480 | LNG(wxLANGUAGE_FRENCH_LUXEMBOURG, "fr_LU", LANG_FRENCH , SUBLANG_FRENCH_LUXEMBOURG , "French (Luxembourg)") | |
3481 | LNG(wxLANGUAGE_FRENCH_MONACO, "fr_MC", LANG_FRENCH , SUBLANG_FRENCH_MONACO , "French (Monaco)") | |
3482 | LNG(wxLANGUAGE_FRENCH_SWISS, "fr_CH", LANG_FRENCH , SUBLANG_FRENCH_SWISS , "French (Swiss)") | |
3483 | LNG(wxLANGUAGE_FRISIAN, "fy" , 0 , 0 , "Frisian") | |
3484 | LNG(wxLANGUAGE_GALICIAN, "gl_ES", 0 , 0 , "Galician") | |
3485 | LNG(wxLANGUAGE_GEORGIAN, "ka" , LANG_GEORGIAN , SUBLANG_DEFAULT , "Georgian") | |
3486 | LNG(wxLANGUAGE_GERMAN, "de_DE", LANG_GERMAN , SUBLANG_GERMAN , "German") | |
3487 | LNG(wxLANGUAGE_GERMAN_AUSTRIAN, "de_AT", LANG_GERMAN , SUBLANG_GERMAN_AUSTRIAN , "German (Austrian)") | |
3488 | LNG(wxLANGUAGE_GERMAN_BELGIUM, "de_BE", 0 , 0 , "German (Belgium)") | |
3489 | LNG(wxLANGUAGE_GERMAN_LIECHTENSTEIN, "de_LI", LANG_GERMAN , SUBLANG_GERMAN_LIECHTENSTEIN , "German (Liechtenstein)") | |
3490 | LNG(wxLANGUAGE_GERMAN_LUXEMBOURG, "de_LU", LANG_GERMAN , SUBLANG_GERMAN_LUXEMBOURG , "German (Luxembourg)") | |
3491 | LNG(wxLANGUAGE_GERMAN_SWISS, "de_CH", LANG_GERMAN , SUBLANG_GERMAN_SWISS , "German (Swiss)") | |
3492 | LNG(wxLANGUAGE_GREEK, "el_GR", LANG_GREEK , SUBLANG_DEFAULT , "Greek") | |
3493 | LNG(wxLANGUAGE_GREENLANDIC, "kl_GL", 0 , 0 , "Greenlandic") | |
3494 | LNG(wxLANGUAGE_GUARANI, "gn" , 0 , 0 , "Guarani") | |
3495 | LNG(wxLANGUAGE_GUJARATI, "gu" , LANG_GUJARATI , SUBLANG_DEFAULT , "Gujarati") | |
3496 | LNG(wxLANGUAGE_HAUSA, "ha" , 0 , 0 , "Hausa") | |
3497 | LNG(wxLANGUAGE_HEBREW, "he_IL", LANG_HEBREW , SUBLANG_DEFAULT , "Hebrew") | |
3498 | LNG(wxLANGUAGE_HINDI, "hi_IN", LANG_HINDI , SUBLANG_DEFAULT , "Hindi") | |
3499 | LNG(wxLANGUAGE_HUNGARIAN, "hu_HU", LANG_HUNGARIAN , SUBLANG_DEFAULT , "Hungarian") | |
3500 | LNG(wxLANGUAGE_ICELANDIC, "is_IS", LANG_ICELANDIC , SUBLANG_DEFAULT , "Icelandic") | |
3501 | LNG(wxLANGUAGE_INDONESIAN, "id_ID", LANG_INDONESIAN, SUBLANG_DEFAULT , "Indonesian") | |
3502 | LNG(wxLANGUAGE_INTERLINGUA, "ia" , 0 , 0 , "Interlingua") | |
3503 | LNG(wxLANGUAGE_INTERLINGUE, "ie" , 0 , 0 , "Interlingue") | |
3504 | LNG(wxLANGUAGE_INUKTITUT, "iu" , 0 , 0 , "Inuktitut") | |
3505 | LNG(wxLANGUAGE_INUPIAK, "ik" , 0 , 0 , "Inupiak") | |
3506 | LNG(wxLANGUAGE_IRISH, "ga_IE", 0 , 0 , "Irish") | |
3507 | LNG(wxLANGUAGE_ITALIAN, "it_IT", LANG_ITALIAN , SUBLANG_ITALIAN , "Italian") | |
3508 | LNG(wxLANGUAGE_ITALIAN_SWISS, "it_CH", LANG_ITALIAN , SUBLANG_ITALIAN_SWISS , "Italian (Swiss)") | |
3509 | LNG(wxLANGUAGE_JAPANESE, "ja_JP", LANG_JAPANESE , SUBLANG_DEFAULT , "Japanese") | |
3510 | LNG(wxLANGUAGE_JAVANESE, "jw" , 0 , 0 , "Javanese") | |
3511 | LNG(wxLANGUAGE_KANNADA, "kn" , LANG_KANNADA , SUBLANG_DEFAULT , "Kannada") | |
3512 | LNG(wxLANGUAGE_KASHMIRI, "ks" , LANG_KASHMIRI , SUBLANG_DEFAULT , "Kashmiri") | |
3513 | LNG(wxLANGUAGE_KASHMIRI_INDIA, "ks_IN", LANG_KASHMIRI , SUBLANG_KASHMIRI_INDIA , "Kashmiri (India)") | |
3514 | LNG(wxLANGUAGE_KAZAKH, "kk" , LANG_KAZAK , SUBLANG_DEFAULT , "Kazakh") | |
c611452f | 3515 | LNG(wxLANGUAGE_KERNEWEK, "kw_GB", 0 , 0 , "Kernewek") |
d3f3e35f VS |
3516 | LNG(wxLANGUAGE_KINYARWANDA, "rw" , 0 , 0 , "Kinyarwanda") |
3517 | LNG(wxLANGUAGE_KIRGHIZ, "ky" , 0 , 0 , "Kirghiz") | |
3518 | LNG(wxLANGUAGE_KIRUNDI, "rn" , 0 , 0 , "Kirundi") | |
3519 | LNG(wxLANGUAGE_KONKANI, "" , LANG_KONKANI , SUBLANG_DEFAULT , "Konkani") | |
3520 | LNG(wxLANGUAGE_KOREAN, "ko_KR", LANG_KOREAN , SUBLANG_KOREAN , "Korean") | |
3521 | LNG(wxLANGUAGE_KURDISH, "ku" , 0 , 0 , "Kurdish") | |
3522 | LNG(wxLANGUAGE_LAOTHIAN, "lo" , 0 , 0 , "Laothian") | |
3523 | LNG(wxLANGUAGE_LATIN, "la" , 0 , 0 , "Latin") | |
3524 | LNG(wxLANGUAGE_LATVIAN, "lv_LV", LANG_LATVIAN , SUBLANG_DEFAULT , "Latvian") | |
3525 | LNG(wxLANGUAGE_LINGALA, "ln" , 0 , 0 , "Lingala") | |
3526 | LNG(wxLANGUAGE_LITHUANIAN, "lt_LT", LANG_LITHUANIAN, SUBLANG_LITHUANIAN , "Lithuanian") | |
3527 | LNG(wxLANGUAGE_MACEDONIAN, "mk_MK", LANG_MACEDONIAN, SUBLANG_DEFAULT , "Macedonian") | |
3528 | LNG(wxLANGUAGE_MALAGASY, "mg" , 0 , 0 , "Malagasy") | |
3529 | LNG(wxLANGUAGE_MALAY, "ms_MY", LANG_MALAY , SUBLANG_DEFAULT , "Malay") | |
3530 | LNG(wxLANGUAGE_MALAYALAM, "ml" , LANG_MALAYALAM , SUBLANG_DEFAULT , "Malayalam") | |
3531 | LNG(wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, "ms_BN", LANG_MALAY , SUBLANG_MALAY_BRUNEI_DARUSSALAM , "Malay (Brunei Darussalam)") | |
3532 | LNG(wxLANGUAGE_MALAY_MALAYSIA, "ms_MY", LANG_MALAY , SUBLANG_MALAY_MALAYSIA , "Malay (Malaysia)") | |
3533 | LNG(wxLANGUAGE_MALTESE, "mt_MT", 0 , 0 , "Maltese") | |
3534 | LNG(wxLANGUAGE_MANIPURI, "" , LANG_MANIPURI , SUBLANG_DEFAULT , "Manipuri") | |
3535 | LNG(wxLANGUAGE_MAORI, "mi" , 0 , 0 , "Maori") | |
3536 | LNG(wxLANGUAGE_MARATHI, "mr_IN", LANG_MARATHI , SUBLANG_DEFAULT , "Marathi") | |
3537 | LNG(wxLANGUAGE_MOLDAVIAN, "mo" , 0 , 0 , "Moldavian") | |
3538 | LNG(wxLANGUAGE_MONGOLIAN, "mn" , 0 , 0 , "Mongolian") | |
3539 | LNG(wxLANGUAGE_NAURU, "na" , 0 , 0 , "Nauru") | |
3540 | LNG(wxLANGUAGE_NEPALI, "ne" , LANG_NEPALI , SUBLANG_DEFAULT , "Nepali") | |
3541 | LNG(wxLANGUAGE_NEPALI_INDIA, "ne_IN", LANG_NEPALI , SUBLANG_NEPALI_INDIA , "Nepali (India)") | |
cf5e94bc | 3542 | LNG(wxLANGUAGE_NORWEGIAN_BOKMAL, "nb_NO", LANG_NORWEGIAN , SUBLANG_NORWEGIAN_BOKMAL , "Norwegian (Bokmal)") |
c611452f | 3543 | LNG(wxLANGUAGE_NORWEGIAN_NYNORSK, "nn_NO", LANG_NORWEGIAN , SUBLANG_NORWEGIAN_NYNORSK , "Norwegian (Nynorsk)") |
d3f3e35f VS |
3544 | LNG(wxLANGUAGE_OCCITAN, "oc" , 0 , 0 , "Occitan") |
3545 | LNG(wxLANGUAGE_ORIYA, "or" , LANG_ORIYA , SUBLANG_DEFAULT , "Oriya") | |
3546 | LNG(wxLANGUAGE_OROMO, "om" , 0 , 0 , "(Afan) Oromo") | |
3547 | LNG(wxLANGUAGE_PASHTO, "ps" , 0 , 0 , "Pashto, Pushto") | |
d3f3e35f VS |
3548 | LNG(wxLANGUAGE_POLISH, "pl_PL", LANG_POLISH , SUBLANG_DEFAULT , "Polish") |
3549 | LNG(wxLANGUAGE_PORTUGUESE, "pt_PT", LANG_PORTUGUESE, SUBLANG_PORTUGUESE , "Portuguese") | |
3550 | LNG(wxLANGUAGE_PORTUGUESE_BRAZILIAN, "pt_BR", LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN , "Portuguese (Brazilian)") | |
3551 | LNG(wxLANGUAGE_PUNJABI, "pa" , LANG_PUNJABI , SUBLANG_DEFAULT , "Punjabi") | |
3552 | LNG(wxLANGUAGE_QUECHUA, "qu" , 0 , 0 , "Quechua") | |
3553 | LNG(wxLANGUAGE_RHAETO_ROMANCE, "rm" , 0 , 0 , "Rhaeto-Romance") | |
3554 | LNG(wxLANGUAGE_ROMANIAN, "ro_RO", LANG_ROMANIAN , SUBLANG_DEFAULT , "Romanian") | |
3555 | LNG(wxLANGUAGE_RUSSIAN, "ru_RU", LANG_RUSSIAN , SUBLANG_DEFAULT , "Russian") | |
3556 | LNG(wxLANGUAGE_RUSSIAN_UKRAINE, "ru_UA", 0 , 0 , "Russian (Ukraine)") | |
3557 | LNG(wxLANGUAGE_SAMOAN, "sm" , 0 , 0 , "Samoan") | |
3558 | LNG(wxLANGUAGE_SANGHO, "sg" , 0 , 0 , "Sangho") | |
3559 | LNG(wxLANGUAGE_SANSKRIT, "sa" , LANG_SANSKRIT , SUBLANG_DEFAULT , "Sanskrit") | |
3560 | LNG(wxLANGUAGE_SCOTS_GAELIC, "gd" , 0 , 0 , "Scots Gaelic") | |
3561 | LNG(wxLANGUAGE_SERBIAN, "sr_YU", LANG_SERBIAN , SUBLANG_DEFAULT , "Serbian") | |
3562 | LNG(wxLANGUAGE_SERBIAN_CYRILLIC, "sr_YU", LANG_SERBIAN , SUBLANG_SERBIAN_CYRILLIC , "Serbian (Cyrillic)") | |
3563 | LNG(wxLANGUAGE_SERBIAN_LATIN, "sr_YU", LANG_SERBIAN , SUBLANG_SERBIAN_LATIN , "Serbian (Latin)") | |
3564 | LNG(wxLANGUAGE_SERBO_CROATIAN, "sh" , 0 , 0 , "Serbo-Croatian") | |
3565 | LNG(wxLANGUAGE_SESOTHO, "st" , 0 , 0 , "Sesotho") | |
3566 | LNG(wxLANGUAGE_SETSWANA, "tn" , 0 , 0 , "Setswana") | |
3567 | LNG(wxLANGUAGE_SHONA, "sn" , 0 , 0 , "Shona") | |
3568 | LNG(wxLANGUAGE_SINDHI, "sd" , LANG_SINDHI , SUBLANG_DEFAULT , "Sindhi") | |
3569 | LNG(wxLANGUAGE_SINHALESE, "si" , 0 , 0 , "Sinhalese") | |
3570 | LNG(wxLANGUAGE_SISWATI, "ss" , 0 , 0 , "Siswati") | |
3571 | LNG(wxLANGUAGE_SLOVAK, "sk_SK", LANG_SLOVAK , SUBLANG_DEFAULT , "Slovak") | |
3572 | LNG(wxLANGUAGE_SLOVENIAN, "sl_SI", LANG_SLOVENIAN , SUBLANG_DEFAULT , "Slovenian") | |
3573 | LNG(wxLANGUAGE_SOMALI, "so" , 0 , 0 , "Somali") | |
3574 | LNG(wxLANGUAGE_SPANISH, "es_ES", LANG_SPANISH , SUBLANG_SPANISH , "Spanish") | |
3575 | LNG(wxLANGUAGE_SPANISH_ARGENTINA, "es_AR", LANG_SPANISH , SUBLANG_SPANISH_ARGENTINA , "Spanish (Argentina)") | |
3576 | LNG(wxLANGUAGE_SPANISH_BOLIVIA, "es_BO", LANG_SPANISH , SUBLANG_SPANISH_BOLIVIA , "Spanish (Bolivia)") | |
3577 | LNG(wxLANGUAGE_SPANISH_CHILE, "es_CL", LANG_SPANISH , SUBLANG_SPANISH_CHILE , "Spanish (Chile)") | |
3578 | LNG(wxLANGUAGE_SPANISH_COLOMBIA, "es_CO", LANG_SPANISH , SUBLANG_SPANISH_COLOMBIA , "Spanish (Colombia)") | |
3579 | LNG(wxLANGUAGE_SPANISH_COSTA_RICA, "es_CR", LANG_SPANISH , SUBLANG_SPANISH_COSTA_RICA , "Spanish (Costa Rica)") | |
3580 | LNG(wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, "es_DO", LANG_SPANISH , SUBLANG_SPANISH_DOMINICAN_REPUBLIC, "Spanish (Dominican republic)") | |
3581 | LNG(wxLANGUAGE_SPANISH_ECUADOR, "es_EC", LANG_SPANISH , SUBLANG_SPANISH_ECUADOR , "Spanish (Ecuador)") | |
3582 | LNG(wxLANGUAGE_SPANISH_EL_SALVADOR, "es_SV", LANG_SPANISH , SUBLANG_SPANISH_EL_SALVADOR , "Spanish (El Salvador)") | |
3583 | LNG(wxLANGUAGE_SPANISH_GUATEMALA, "es_GT", LANG_SPANISH , SUBLANG_SPANISH_GUATEMALA , "Spanish (Guatemala)") | |
3584 | LNG(wxLANGUAGE_SPANISH_HONDURAS, "es_HN", LANG_SPANISH , SUBLANG_SPANISH_HONDURAS , "Spanish (Honduras)") | |
3585 | LNG(wxLANGUAGE_SPANISH_MEXICAN, "es_MX", LANG_SPANISH , SUBLANG_SPANISH_MEXICAN , "Spanish (Mexican)") | |
3586 | LNG(wxLANGUAGE_SPANISH_MODERN, "es_ES", LANG_SPANISH , SUBLANG_SPANISH_MODERN , "Spanish (Modern)") | |
3587 | LNG(wxLANGUAGE_SPANISH_NICARAGUA, "es_NI", LANG_SPANISH , SUBLANG_SPANISH_NICARAGUA , "Spanish (Nicaragua)") | |
3588 | LNG(wxLANGUAGE_SPANISH_PANAMA, "es_PA", LANG_SPANISH , SUBLANG_SPANISH_PANAMA , "Spanish (Panama)") | |
3589 | LNG(wxLANGUAGE_SPANISH_PARAGUAY, "es_PY", LANG_SPANISH , SUBLANG_SPANISH_PARAGUAY , "Spanish (Paraguay)") | |
3590 | LNG(wxLANGUAGE_SPANISH_PERU, "es_PE", LANG_SPANISH , SUBLANG_SPANISH_PERU , "Spanish (Peru)") | |
3591 | LNG(wxLANGUAGE_SPANISH_PUERTO_RICO, "es_PR", LANG_SPANISH , SUBLANG_SPANISH_PUERTO_RICO , "Spanish (Puerto Rico)") | |
3592 | LNG(wxLANGUAGE_SPANISH_URUGUAY, "es_UY", LANG_SPANISH , SUBLANG_SPANISH_URUGUAY , "Spanish (Uruguay)") | |
3593 | LNG(wxLANGUAGE_SPANISH_US, "es_US", 0 , 0 , "Spanish (U.S.)") | |
3594 | LNG(wxLANGUAGE_SPANISH_VENEZUELA, "es_VE", LANG_SPANISH , SUBLANG_SPANISH_VENEZUELA , "Spanish (Venezuela)") | |
3595 | LNG(wxLANGUAGE_SUNDANESE, "su" , 0 , 0 , "Sundanese") | |
3596 | LNG(wxLANGUAGE_SWAHILI, "sw_KE", LANG_SWAHILI , SUBLANG_DEFAULT , "Swahili") | |
3597 | LNG(wxLANGUAGE_SWEDISH, "sv_SE", LANG_SWEDISH , SUBLANG_SWEDISH , "Swedish") | |
3598 | LNG(wxLANGUAGE_SWEDISH_FINLAND, "sv_FI", LANG_SWEDISH , SUBLANG_SWEDISH_FINLAND , "Swedish (Finland)") | |
25a5f9a9 | 3599 | LNG(wxLANGUAGE_TAGALOG, "tl_PH", 0 , 0 , "Tagalog") |
d3f3e35f VS |
3600 | LNG(wxLANGUAGE_TAJIK, "tg" , 0 , 0 , "Tajik") |
3601 | LNG(wxLANGUAGE_TAMIL, "ta" , LANG_TAMIL , SUBLANG_DEFAULT , "Tamil") | |
3602 | LNG(wxLANGUAGE_TATAR, "tt" , LANG_TATAR , SUBLANG_DEFAULT , "Tatar") | |
3603 | LNG(wxLANGUAGE_TELUGU, "te" , LANG_TELUGU , SUBLANG_DEFAULT , "Telugu") | |
3604 | LNG(wxLANGUAGE_THAI, "th_TH", LANG_THAI , SUBLANG_DEFAULT , "Thai") | |
3605 | LNG(wxLANGUAGE_TIBETAN, "bo" , 0 , 0 , "Tibetan") | |
3606 | LNG(wxLANGUAGE_TIGRINYA, "ti" , 0 , 0 , "Tigrinya") | |
3607 | LNG(wxLANGUAGE_TONGA, "to" , 0 , 0 , "Tonga") | |
3608 | LNG(wxLANGUAGE_TSONGA, "ts" , 0 , 0 , "Tsonga") | |
3609 | LNG(wxLANGUAGE_TURKISH, "tr_TR", LANG_TURKISH , SUBLANG_DEFAULT , "Turkish") | |
3610 | LNG(wxLANGUAGE_TURKMEN, "tk" , 0 , 0 , "Turkmen") | |
3611 | LNG(wxLANGUAGE_TWI, "tw" , 0 , 0 , "Twi") | |
3612 | LNG(wxLANGUAGE_UIGHUR, "ug" , 0 , 0 , "Uighur") | |
3613 | LNG(wxLANGUAGE_UKRAINIAN, "uk_UA", LANG_UKRAINIAN , SUBLANG_DEFAULT , "Ukrainian") | |
3614 | LNG(wxLANGUAGE_URDU, "ur" , LANG_URDU , SUBLANG_DEFAULT , "Urdu") | |
3615 | LNG(wxLANGUAGE_URDU_INDIA, "ur_IN", LANG_URDU , SUBLANG_URDU_INDIA , "Urdu (India)") | |
3616 | LNG(wxLANGUAGE_URDU_PAKISTAN, "ur_PK", LANG_URDU , SUBLANG_URDU_PAKISTAN , "Urdu (Pakistan)") | |
3617 | LNG(wxLANGUAGE_UZBEK, "uz" , LANG_UZBEK , SUBLANG_DEFAULT , "Uzbek") | |
3618 | LNG(wxLANGUAGE_UZBEK_CYRILLIC, "uz" , LANG_UZBEK , SUBLANG_UZBEK_CYRILLIC , "Uzbek (Cyrillic)") | |
3619 | LNG(wxLANGUAGE_UZBEK_LATIN, "uz" , LANG_UZBEK , SUBLANG_UZBEK_LATIN , "Uzbek (Latin)") | |
3620 | LNG(wxLANGUAGE_VIETNAMESE, "vi_VN", LANG_VIETNAMESE, SUBLANG_DEFAULT , "Vietnamese") | |
3621 | LNG(wxLANGUAGE_VOLAPUK, "vo" , 0 , 0 , "Volapuk") | |
3622 | LNG(wxLANGUAGE_WELSH, "cy" , 0 , 0 , "Welsh") | |
3623 | LNG(wxLANGUAGE_WOLOF, "wo" , 0 , 0 , "Wolof") | |
3624 | LNG(wxLANGUAGE_XHOSA, "xh" , 0 , 0 , "Xhosa") | |
3625 | LNG(wxLANGUAGE_YIDDISH, "yi" , 0 , 0 , "Yiddish") | |
3626 | LNG(wxLANGUAGE_YORUBA, "yo" , 0 , 0 , "Yoruba") | |
3627 | LNG(wxLANGUAGE_ZHUANG, "za" , 0 , 0 , "Zhuang") | |
3628 | LNG(wxLANGUAGE_ZULU, "zu" , 0 , 0 , "Zulu") | |
9e7ed2b0 | 3629 | |
4115960d | 3630 | } |
d3f3e35f VS |
3631 | #undef LNG |
3632 | ||
41780009 VS |
3633 | // --- --- --- generated code ends here --- --- --- |
3634 | ||
d427503c | 3635 | #endif // wxUSE_INTL |