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