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