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