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