]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
58d5dfc1 | 2 | // Name: wx/intl.h |
c801d85f KB |
3 | // Purpose: Internationalization and localisation for wxWindows |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 29/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
371a5b4e | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
dccce9ea VZ |
12 | #ifndef _WX_INTL_H_ |
13 | #define _WX_INTL_H_ | |
c801d85f | 14 | |
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
84c18814 | 16 | #pragma interface "intl.h" |
c801d85f KB |
17 | #endif |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/string.h" | |
21 | ||
88ac883a VZ |
22 | #if wxUSE_INTL |
23 | ||
dccce9ea VZ |
24 | #include "wx/fontenc.h" |
25 | ||
c801d85f KB |
26 | // ============================================================================ |
27 | // global decls | |
28 | // ============================================================================ | |
29 | ||
c801d85f KB |
30 | // ---------------------------------------------------------------------------- |
31 | // macros | |
32 | // ---------------------------------------------------------------------------- | |
33 | ||
84c18814 VZ |
34 | // gettext() style macro (notice that xgettext should be invoked with "-k_" |
35 | // option to extract the strings inside _() from the sources) | |
687d7337 | 36 | #ifndef WXINTL_NO_GETTEXT_MACRO |
b12915c1 | 37 | #define _(str) wxGetTranslation(_T(str)) |
687d7337 | 38 | #endif |
c801d85f | 39 | |
3c1866e8 VZ |
40 | // another one which just marks the strings for extraction, but doesn't |
41 | // perform the translation (use -kwxTRANSLATE with xgettext!) | |
b12915c1 | 42 | #define wxTRANSLATE(str) _T(str) |
3c1866e8 | 43 | |
c801d85f KB |
44 | // ---------------------------------------------------------------------------- |
45 | // forward decls | |
46 | // ---------------------------------------------------------------------------- | |
ec37df57 | 47 | |
c801d85f KB |
48 | class WXDLLEXPORT wxLocale; |
49 | class WXDLLEXPORT wxMsgCatalog; | |
fda91381 | 50 | class WXDLLEXPORT wxLanguageInfoArray; |
c801d85f KB |
51 | |
52 | // ============================================================================ | |
53 | // locale support | |
54 | // ============================================================================ | |
55 | ||
fda91381 VS |
56 | // ---------------------------------------------------------------------------- |
57 | // wxLanguage: defines all supported languages | |
58 | // ---------------------------------------------------------------------------- | |
59 | ||
41780009 | 60 | // --- --- --- generated code begins here --- --- --- |
fda91381 VS |
61 | |
62 | // This enum is generated by misc/languages/genlang.py | |
63 | // When making changes, please put them into misc/languages/langtabl.txt | |
64 | enum wxLanguage | |
65 | { | |
66 | // user's default/preffered language as got from OS: | |
58d5dfc1 | 67 | wxLANGUAGE_DEFAULT, |
fda91381 | 68 | // unknown language, if wxLocale::GetSystemLanguage fails: |
58d5dfc1 VZ |
69 | wxLANGUAGE_UNKNOWN, |
70 | ||
fda91381 VS |
71 | wxLANGUAGE_ABKHAZIAN, |
72 | wxLANGUAGE_AFAR, | |
73 | wxLANGUAGE_AFRIKAANS, | |
74 | wxLANGUAGE_ALBANIAN, | |
75 | wxLANGUAGE_AMHARIC, | |
76 | wxLANGUAGE_ARABIC, | |
77 | wxLANGUAGE_ARABIC_ALGERIA, | |
78 | wxLANGUAGE_ARABIC_BAHRAIN, | |
79 | wxLANGUAGE_ARABIC_EGYPT, | |
80 | wxLANGUAGE_ARABIC_IRAQ, | |
81 | wxLANGUAGE_ARABIC_JORDAN, | |
82 | wxLANGUAGE_ARABIC_KUWAIT, | |
83 | wxLANGUAGE_ARABIC_LEBANON, | |
84 | wxLANGUAGE_ARABIC_LIBYA, | |
85 | wxLANGUAGE_ARABIC_MOROCCO, | |
86 | wxLANGUAGE_ARABIC_OMAN, | |
87 | wxLANGUAGE_ARABIC_QATAR, | |
88 | wxLANGUAGE_ARABIC_SAUDI_ARABIA, | |
89 | wxLANGUAGE_ARABIC_SUDAN, | |
90 | wxLANGUAGE_ARABIC_SYRIA, | |
91 | wxLANGUAGE_ARABIC_TUNISIA, | |
92 | wxLANGUAGE_ARABIC_UAE, | |
93 | wxLANGUAGE_ARABIC_YEMEN, | |
94 | wxLANGUAGE_ARMENIAN, | |
95 | wxLANGUAGE_ASSAMESE, | |
96 | wxLANGUAGE_AYMARA, | |
97 | wxLANGUAGE_AZERI, | |
98 | wxLANGUAGE_AZERI_CYRILLIC, | |
99 | wxLANGUAGE_AZERI_LATIN, | |
100 | wxLANGUAGE_BASHKIR, | |
101 | wxLANGUAGE_BASQUE, | |
102 | wxLANGUAGE_BELARUSIAN, | |
103 | wxLANGUAGE_BENGALI, | |
104 | wxLANGUAGE_BHUTANI, | |
105 | wxLANGUAGE_BIHARI, | |
106 | wxLANGUAGE_BISLAMA, | |
107 | wxLANGUAGE_BRETON, | |
108 | wxLANGUAGE_BULGARIAN, | |
109 | wxLANGUAGE_BURMESE, | |
110 | wxLANGUAGE_CAMBODIAN, | |
111 | wxLANGUAGE_CATALAN, | |
112 | wxLANGUAGE_CHINESE, | |
113 | wxLANGUAGE_CHINESE_SIMPLIFIED, | |
114 | wxLANGUAGE_CHINESE_TRADITIONAL, | |
115 | wxLANGUAGE_CHINESE_HONGKONG, | |
116 | wxLANGUAGE_CHINESE_MACAU, | |
117 | wxLANGUAGE_CHINESE_SINGAPORE, | |
118 | wxLANGUAGE_CHINESE_TAIWAN, | |
119 | wxLANGUAGE_CORSICAN, | |
120 | wxLANGUAGE_CROATIAN, | |
121 | wxLANGUAGE_CZECH, | |
122 | wxLANGUAGE_DANISH, | |
123 | wxLANGUAGE_DUTCH, | |
124 | wxLANGUAGE_DUTCH_BELGIAN, | |
125 | wxLANGUAGE_ENGLISH, | |
126 | wxLANGUAGE_ENGLISH_UK, | |
127 | wxLANGUAGE_ENGLISH_US, | |
128 | wxLANGUAGE_ENGLISH_AUSTRALIA, | |
129 | wxLANGUAGE_ENGLISH_BELIZE, | |
130 | wxLANGUAGE_ENGLISH_BOTSWANA, | |
131 | wxLANGUAGE_ENGLISH_CANADA, | |
132 | wxLANGUAGE_ENGLISH_CARIBBEAN, | |
133 | wxLANGUAGE_ENGLISH_DENMARK, | |
134 | wxLANGUAGE_ENGLISH_EIRE, | |
135 | wxLANGUAGE_ENGLISH_JAMAICA, | |
136 | wxLANGUAGE_ENGLISH_NEW_ZEALAND, | |
137 | wxLANGUAGE_ENGLISH_PHILIPPINES, | |
138 | wxLANGUAGE_ENGLISH_SOUTH_AFRICA, | |
139 | wxLANGUAGE_ENGLISH_TRINIDAD, | |
140 | wxLANGUAGE_ENGLISH_ZIMBABWE, | |
141 | wxLANGUAGE_ESPERANTO, | |
142 | wxLANGUAGE_ESTONIAN, | |
143 | wxLANGUAGE_FAEROESE, | |
144 | wxLANGUAGE_FARSI, | |
145 | wxLANGUAGE_FIJI, | |
146 | wxLANGUAGE_FINNISH, | |
147 | wxLANGUAGE_FRENCH, | |
148 | wxLANGUAGE_FRENCH_BELGIAN, | |
149 | wxLANGUAGE_FRENCH_CANADIAN, | |
150 | wxLANGUAGE_FRENCH_LUXEMBOURG, | |
151 | wxLANGUAGE_FRENCH_MONACO, | |
152 | wxLANGUAGE_FRENCH_SWISS, | |
153 | wxLANGUAGE_FRISIAN, | |
154 | wxLANGUAGE_GALICIAN, | |
155 | wxLANGUAGE_GEORGIAN, | |
156 | wxLANGUAGE_GERMAN, | |
157 | wxLANGUAGE_GERMAN_AUSTRIAN, | |
158 | wxLANGUAGE_GERMAN_BELGIUM, | |
159 | wxLANGUAGE_GERMAN_LIECHTENSTEIN, | |
160 | wxLANGUAGE_GERMAN_LUXEMBOURG, | |
161 | wxLANGUAGE_GERMAN_SWISS, | |
162 | wxLANGUAGE_GREEK, | |
163 | wxLANGUAGE_GREENLANDIC, | |
164 | wxLANGUAGE_GUARANI, | |
165 | wxLANGUAGE_GUJARATI, | |
166 | wxLANGUAGE_HAUSA, | |
167 | wxLANGUAGE_HEBREW, | |
168 | wxLANGUAGE_HINDI, | |
169 | wxLANGUAGE_HUNGARIAN, | |
170 | wxLANGUAGE_ICELANDIC, | |
171 | wxLANGUAGE_INDONESIAN, | |
172 | wxLANGUAGE_INTERLINGUA, | |
173 | wxLANGUAGE_INTERLINGUE, | |
174 | wxLANGUAGE_INUKTITUT, | |
175 | wxLANGUAGE_INUPIAK, | |
176 | wxLANGUAGE_IRISH, | |
177 | wxLANGUAGE_ITALIAN, | |
178 | wxLANGUAGE_ITALIAN_SWISS, | |
179 | wxLANGUAGE_JAPANESE, | |
180 | wxLANGUAGE_JAVANESE, | |
181 | wxLANGUAGE_KANNADA, | |
182 | wxLANGUAGE_KASHMIRI, | |
183 | wxLANGUAGE_KASHMIRI_INDIA, | |
184 | wxLANGUAGE_KAZAKH, | |
185 | wxLANGUAGE_KERNEWEK, | |
186 | wxLANGUAGE_KINYARWANDA, | |
187 | wxLANGUAGE_KIRGHIZ, | |
188 | wxLANGUAGE_KIRUNDI, | |
189 | wxLANGUAGE_KONKANI, | |
190 | wxLANGUAGE_KOREAN, | |
191 | wxLANGUAGE_KURDISH, | |
192 | wxLANGUAGE_LAOTHIAN, | |
193 | wxLANGUAGE_LATIN, | |
194 | wxLANGUAGE_LATVIAN, | |
195 | wxLANGUAGE_LINGALA, | |
196 | wxLANGUAGE_LITHUANIAN, | |
197 | wxLANGUAGE_MACEDONIAN, | |
198 | wxLANGUAGE_MALAGASY, | |
199 | wxLANGUAGE_MALAY, | |
200 | wxLANGUAGE_MALAYALAM, | |
201 | wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM, | |
202 | wxLANGUAGE_MALAY_MALAYSIA, | |
203 | wxLANGUAGE_MALTESE, | |
204 | wxLANGUAGE_MANIPURI, | |
205 | wxLANGUAGE_MAORI, | |
206 | wxLANGUAGE_MARATHI, | |
207 | wxLANGUAGE_MOLDAVIAN, | |
208 | wxLANGUAGE_MONGOLIAN, | |
209 | wxLANGUAGE_NAURU, | |
210 | wxLANGUAGE_NEPALI, | |
211 | wxLANGUAGE_NEPALI_INDIA, | |
212 | wxLANGUAGE_NORWEGIAN_BOKMAL, | |
213 | wxLANGUAGE_NORWEGIAN_NYNORSK, | |
214 | wxLANGUAGE_OCCITAN, | |
215 | wxLANGUAGE_ORIYA, | |
216 | wxLANGUAGE_OROMO, | |
217 | wxLANGUAGE_PASHTO, | |
218 | wxLANGUAGE_POLISH, | |
219 | wxLANGUAGE_PORTUGUESE, | |
220 | wxLANGUAGE_PORTUGUESE_BRAZILIAN, | |
221 | wxLANGUAGE_PUNJABI, | |
222 | wxLANGUAGE_QUECHUA, | |
223 | wxLANGUAGE_RHAETO_ROMANCE, | |
224 | wxLANGUAGE_ROMANIAN, | |
225 | wxLANGUAGE_RUSSIAN, | |
226 | wxLANGUAGE_RUSSIAN_UKRAINE, | |
227 | wxLANGUAGE_SAMOAN, | |
228 | wxLANGUAGE_SANGHO, | |
229 | wxLANGUAGE_SANSKRIT, | |
230 | wxLANGUAGE_SCOTS_GAELIC, | |
231 | wxLANGUAGE_SERBIAN, | |
232 | wxLANGUAGE_SERBIAN_CYRILLIC, | |
233 | wxLANGUAGE_SERBIAN_LATIN, | |
234 | wxLANGUAGE_SERBO_CROATIAN, | |
235 | wxLANGUAGE_SESOTHO, | |
236 | wxLANGUAGE_SETSWANA, | |
237 | wxLANGUAGE_SHONA, | |
238 | wxLANGUAGE_SINDHI, | |
239 | wxLANGUAGE_SINHALESE, | |
240 | wxLANGUAGE_SISWATI, | |
241 | wxLANGUAGE_SLOVAK, | |
242 | wxLANGUAGE_SLOVENIAN, | |
243 | wxLANGUAGE_SOMALI, | |
244 | wxLANGUAGE_SPANISH, | |
245 | wxLANGUAGE_SPANISH_ARGENTINA, | |
246 | wxLANGUAGE_SPANISH_BOLIVIA, | |
247 | wxLANGUAGE_SPANISH_CHILE, | |
248 | wxLANGUAGE_SPANISH_COLOMBIA, | |
249 | wxLANGUAGE_SPANISH_COSTA_RICA, | |
250 | wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC, | |
251 | wxLANGUAGE_SPANISH_ECUADOR, | |
252 | wxLANGUAGE_SPANISH_EL_SALVADOR, | |
253 | wxLANGUAGE_SPANISH_GUATEMALA, | |
254 | wxLANGUAGE_SPANISH_HONDURAS, | |
255 | wxLANGUAGE_SPANISH_MEXICAN, | |
256 | wxLANGUAGE_SPANISH_MODERN, | |
257 | wxLANGUAGE_SPANISH_NICARAGUA, | |
258 | wxLANGUAGE_SPANISH_PANAMA, | |
259 | wxLANGUAGE_SPANISH_PARAGUAY, | |
260 | wxLANGUAGE_SPANISH_PERU, | |
261 | wxLANGUAGE_SPANISH_PUERTO_RICO, | |
262 | wxLANGUAGE_SPANISH_URUGUAY, | |
263 | wxLANGUAGE_SPANISH_US, | |
264 | wxLANGUAGE_SPANISH_VENEZUELA, | |
265 | wxLANGUAGE_SUNDANESE, | |
266 | wxLANGUAGE_SWAHILI, | |
267 | wxLANGUAGE_SWEDISH, | |
268 | wxLANGUAGE_SWEDISH_FINLAND, | |
269 | wxLANGUAGE_TAGALOG, | |
270 | wxLANGUAGE_TAJIK, | |
271 | wxLANGUAGE_TAMIL, | |
272 | wxLANGUAGE_TATAR, | |
273 | wxLANGUAGE_TELUGU, | |
274 | wxLANGUAGE_THAI, | |
275 | wxLANGUAGE_TIBETAN, | |
276 | wxLANGUAGE_TIGRINYA, | |
277 | wxLANGUAGE_TONGA, | |
278 | wxLANGUAGE_TSONGA, | |
279 | wxLANGUAGE_TURKISH, | |
280 | wxLANGUAGE_TURKMEN, | |
281 | wxLANGUAGE_TWI, | |
282 | wxLANGUAGE_UIGHUR, | |
283 | wxLANGUAGE_UKRAINIAN, | |
284 | wxLANGUAGE_URDU, | |
285 | wxLANGUAGE_URDU_INDIA, | |
286 | wxLANGUAGE_URDU_PAKISTAN, | |
287 | wxLANGUAGE_UZBEK, | |
288 | wxLANGUAGE_UZBEK_CYRILLIC, | |
289 | wxLANGUAGE_UZBEK_LATIN, | |
290 | wxLANGUAGE_VIETNAMESE, | |
291 | wxLANGUAGE_VOLAPUK, | |
292 | wxLANGUAGE_WELSH, | |
293 | wxLANGUAGE_WOLOF, | |
294 | wxLANGUAGE_XHOSA, | |
295 | wxLANGUAGE_YIDDISH, | |
296 | wxLANGUAGE_YORUBA, | |
297 | wxLANGUAGE_ZHUANG, | |
298 | wxLANGUAGE_ZULU, | |
299 | ||
300 | // for custom, user-defined languages: | |
301 | wxLANGUAGE_USER_DEFINED | |
302 | }; | |
303 | ||
41780009 VS |
304 | // --- --- --- generated code ends here --- --- --- |
305 | ||
fda91381 VS |
306 | // ---------------------------------------------------------------------------- |
307 | // wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc. | |
308 | // translation information | |
309 | // ---------------------------------------------------------------------------- | |
310 | ||
311 | struct WXDLLEXPORT wxLanguageInfo | |
312 | { | |
313 | int Language; // wxLanguage id | |
314 | wxString CanonicalName; // Canonical name, e.g. fr_FR | |
315 | #ifdef __WIN32__ | |
dccce9ea VZ |
316 | wxUint32 WinLang, // Win32 language identifiers |
317 | WinSublang; | |
318 | #endif // __WIN32__ | |
fda91381 VS |
319 | wxString Description; // human-readable name of the language |
320 | }; | |
321 | ||
f2a139ad VZ |
322 | // ---------------------------------------------------------------------------- |
323 | // wxLocaleCategory: the category of locale settings | |
324 | // ---------------------------------------------------------------------------- | |
325 | ||
326 | enum wxLocaleCategory | |
327 | { | |
328 | // (any) numbers | |
329 | wxLOCALE_CAT_NUMBER, | |
330 | ||
331 | // date/time | |
332 | wxLOCALE_CAT_DATE, | |
333 | ||
334 | // monetary value | |
335 | wxLOCALE_CAT_MONEY, | |
336 | ||
337 | wxLOCALE_CAT_MAX | |
338 | }; | |
339 | ||
340 | // ---------------------------------------------------------------------------- | |
341 | // wxLocaleInfo: the items understood by wxLocale::GetInfo() | |
342 | // ---------------------------------------------------------------------------- | |
343 | ||
344 | enum wxLocaleInfo | |
345 | { | |
346 | // the thounsands separator | |
347 | wxLOCALE_THOUSANDS_SEP, | |
348 | ||
349 | // the character used as decimal point | |
7d08179a | 350 | wxLOCALE_DECIMAL_POINT |
f2a139ad VZ |
351 | |
352 | }; | |
353 | ||
c801d85f KB |
354 | // ---------------------------------------------------------------------------- |
355 | // wxLocale: encapsulates all language dependent settings, including current | |
84c18814 | 356 | // message catalogs, date, time and currency formats (TODO) &c |
c801d85f | 357 | // ---------------------------------------------------------------------------- |
fda91381 VS |
358 | |
359 | enum wxLocaleInitFlags | |
360 | { | |
361 | wxLOCALE_LOAD_DEFAULT = 0x0001, // load wxwin.mo? | |
362 | wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly? | |
363 | }; | |
364 | ||
c801d85f KB |
365 | class WXDLLEXPORT wxLocale |
366 | { | |
367 | public: | |
84c18814 VZ |
368 | // ctor & dtor |
369 | // ----------- | |
370 | ||
371 | // call Init() if you use this ctor | |
372 | wxLocale(); | |
373 | // the ctor has a side effect of changing current locale | |
afc94fa6 | 374 | wxLocale(const wxChar *szName, // name (for messages) |
7b36d720 OK |
375 | const wxChar *szShort = (const wxChar *) NULL, // dir prefix (for msg files) |
376 | const wxChar *szLocale = (const wxChar *) NULL, // locale (for setlocale) | |
afc94fa6 VS |
377 | bool bLoadDefault = TRUE, // preload wxstd.mo? |
378 | bool bConvertEncoding = FALSE) // convert Win<->Unix if neccessary? | |
58d5dfc1 VZ |
379 | { |
380 | Init(szName, szShort, szLocale, bLoadDefault, bConvertEncoding); | |
fda91381 VS |
381 | } |
382 | ||
ec37df57 | 383 | wxLocale(int language, // wxLanguage id or custom language |
fda91381 VS |
384 | int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING) |
385 | { Init(language, flags); } | |
386 | ||
84c18814 | 387 | // the same as a function (returns TRUE on success) |
7b36d720 OK |
388 | bool Init(const wxChar *szName, |
389 | const wxChar *szShort = (const wxChar *) NULL, | |
390 | const wxChar *szLocale = (const wxChar *) NULL, | |
afc94fa6 VS |
391 | bool bLoadDefault = TRUE, |
392 | bool bConvertEncoding = FALSE); | |
fda91381 | 393 | |
ec37df57 | 394 | // same as second ctor (returns TRUE on success) |
fda91381 VS |
395 | bool Init(int language = wxLANGUAGE_DEFAULT, |
396 | int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING); | |
ec37df57 | 397 | |
84c18814 VZ |
398 | // restores old locale |
399 | ~wxLocale(); | |
58d5dfc1 | 400 | |
fda91381 | 401 | // Try to get user's (or OS's) prefered language setting. |
ec37df57 | 402 | // Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed |
41780009 | 403 | static int GetSystemLanguage(); |
84c18814 | 404 | |
dccce9ea VZ |
405 | // get the encoding used by default for text on this system, returns |
406 | // wxFONTENCODING_SYSTEM if it couldn't be determined | |
407 | static wxFontEncoding GetSystemEncoding(); | |
408 | ||
409 | // get the string describing the system encoding, return empty string if | |
410 | // couldn't be determined | |
411 | static wxString GetSystemEncodingName(); | |
412 | ||
f2a139ad VZ |
413 | // get the values of the given locale-dependent datum: the current locale |
414 | // is used, the US default value is returned if everything else fails | |
415 | static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat); | |
416 | ||
3ca6a5f0 BP |
417 | // return TRUE if the locale was set successfully |
418 | bool IsOk() const { return m_pszOldLocale != NULL; } | |
419 | ||
84c18814 | 420 | // returns locale name |
7b36d720 | 421 | const wxChar *GetLocale() const { return m_strLocale; } |
58d5dfc1 | 422 | |
fda91381 VS |
423 | // return current locale wxLanguage value |
424 | int GetLanguage() const { return m_language; } | |
84c18814 | 425 | |
58d5dfc1 | 426 | // return locale name to be passed to setlocale() |
fda91381 VS |
427 | wxString GetSysName() const; |
428 | ||
58d5dfc1 | 429 | // return 'canonical' name, i.e. in the form of xx[_YY], where xx is |
fda91381 VS |
430 | // language code according to ISO 639 and YY is country name |
431 | // as specified by ISO 3166. | |
432 | wxString GetCanonicalName() const { return m_strShort; } | |
58d5dfc1 | 433 | |
84c18814 VZ |
434 | // add a prefix to the catalog lookup path: the message catalog files will be |
435 | // looked up under prefix/<lang>/LC_MESSAGES, prefix/LC_MESSAGES and prefix | |
436 | // (in this order). | |
437 | // | |
438 | // This only applies to subsequent invocations of AddCatalog()! | |
439 | static void AddCatalogLookupPathPrefix(const wxString& prefix); | |
440 | ||
441 | // add a catalog: it's searched for in standard places (current directory | |
442 | // first, system one after), but the you may prepend additional directories to | |
443 | // the search path with AddCatalogLookupPathPrefix(). | |
444 | // | |
445 | // The loaded catalog will be used for message lookup by GetString(). | |
446 | // | |
447 | // Returns 'true' if it was successfully loaded | |
7b36d720 | 448 | bool AddCatalog(const wxChar *szDomain); |
84c18814 VZ |
449 | |
450 | // check if the given catalog is loaded | |
7b36d720 | 451 | bool IsLoaded(const wxChar *szDomain) const; |
58d5dfc1 | 452 | |
14f8fa9d VZ |
453 | // Retrieve the language info struct for the given language |
454 | // | |
455 | // Returns NULL if no info found, pointer must *not* be deleted by caller | |
456 | static const wxLanguageInfo *GetLanguageInfo(int lang); | |
457 | ||
9d1e1be4 VZ |
458 | // Find the language for the given locale string which may be either a |
459 | // canonical ISO 2 letter language code ("xx"), a language code followed by | |
460 | // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") | |
461 | // | |
462 | // Returns NULL if no info found, pointer must *not* be deleted by caller | |
463 | static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); | |
464 | ||
fda91381 VS |
465 | // Add custom language to the list of known languages. |
466 | // Notes: 1) wxLanguageInfo contains platform-specific data | |
467 | // 2) must be called before Init to have effect | |
41780009 | 468 | static void AddLanguage(const wxLanguageInfo& info); |
84c18814 VZ |
469 | |
470 | // retrieve the translation for a string in all loaded domains unless | |
471 | // the szDomain parameter is specified (and then only this domain is | |
472 | // searched) | |
473 | // | |
474 | // return original string if translation is not available | |
475 | // (in this case an error message is generated the first time | |
476 | // a string is not found; use wxLogNull to suppress it) | |
477 | // | |
478 | // domains are searched in the last to first order, i.e. catalogs | |
479 | // added later override those added before. | |
563d535e VS |
480 | const wxChar *GetString(const wxChar *szOrigString, |
481 | const wxChar *szDomain = (const wxChar *) NULL) const; | |
84c18814 VZ |
482 | |
483 | // Returns the current short name for the locale | |
484 | const wxString& GetName() const { return m_strShort; } | |
485 | ||
41780009 VS |
486 | // These two methods are for internal use only. First one creates |
487 | // ms_languagesDB if it doesn't already exist, second one destroys | |
488 | // it. | |
489 | static void CreateLanguagesDB(); | |
490 | static void DestroyLanguagesDB(); | |
491 | ||
84c18814 VZ |
492 | private: |
493 | // find catalog by name in a linked list, return NULL if !found | |
7b36d720 | 494 | wxMsgCatalog *FindCatalog(const wxChar *szDomain) const; |
58d5dfc1 | 495 | |
fda91381 | 496 | // copy default table of languages from global static array to |
41780009 VS |
497 | // m_langugagesInfo, called by InitLanguagesDB |
498 | static void InitLanguagesDB(); | |
84c18814 | 499 | |
afc94fa6 VS |
500 | wxString m_strLocale, // this locale name |
501 | m_strShort; // short name for the locale | |
fda91381 | 502 | int m_language; // this locale wxLanguage value |
84c18814 | 503 | |
afc94fa6 VS |
504 | const wxChar *m_pszOldLocale; // previous locale from setlocale() |
505 | wxLocale *m_pOldLocale; // previous wxLocale | |
84c18814 | 506 | |
afc94fa6 | 507 | wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs |
58d5dfc1 | 508 | |
afc94fa6 | 509 | bool m_bConvertEncoding; |
fda91381 | 510 | |
41780009 | 511 | static wxLanguageInfoArray *ms_languagesDB; |
22f3361e VZ |
512 | |
513 | DECLARE_NO_COPY_CLASS(wxLocale) | |
c801d85f KB |
514 | }; |
515 | ||
9d8046f6 | 516 | // ---------------------------------------------------------------------------- |
a1530845 | 517 | // global functions |
9d8046f6 VZ |
518 | // ---------------------------------------------------------------------------- |
519 | ||
84c18814 VZ |
520 | // get the current locale object (note that it may be NULL!) |
521 | extern WXDLLEXPORT wxLocale* wxGetLocale(); | |
522 | ||
523 | // get the translation of the string in the current locale | |
563d535e | 524 | inline const wxChar *wxGetTranslation(const wxChar *sz) |
9d8046f6 | 525 | { |
84c18814 | 526 | wxLocale *pLoc = wxGetLocale(); |
06c545a7 OK |
527 | if (pLoc) |
528 | return pLoc->GetString(sz); | |
529 | else | |
563d535e | 530 | return sz; |
9d8046f6 VZ |
531 | } |
532 | ||
88ac883a VZ |
533 | #else // !wxUSE_INTL |
534 | ||
b12915c1 VZ |
535 | // the macros should still be defined - otherwise compilation would fail |
536 | ||
537 | #if !defined(WXINTL_NO_GETTEXT_MACRO) && !defined(_) | |
7df93c2d | 538 | #define _(str) (_T(str)) |
88ac883a VZ |
539 | #endif |
540 | ||
b12915c1 VZ |
541 | #define wxTRANSLATE(str) _T(str) |
542 | ||
54800df8 JS |
543 | // Note: use of 'inline' here can cause this symbol not to be found when compiled with gcc |
544 | //const wxChar *wxGetTranslation(const wxChar *sz); | |
dfdd617b | 545 | #define wxGetTranslation(sz) (sz) |
88ac883a VZ |
546 | |
547 | #endif // wxUSE_INTL/!wxUSE_INTL | |
548 | ||
b12915c1 VZ |
549 | // define this one just in case it occurs somewhere (instead of preferred |
550 | // wxTRANSLATE) too | |
551 | #if !defined(WXINTL_NO_GETTEXT_MACRO) && !defined(gettext_noop) | |
552 | #define gettext_noop(str) _T(str) | |
553 | #endif | |
554 | ||
dccce9ea VZ |
555 | #endif // _WX_INTL_H_ |
556 |