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