]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxLocale}}\label{wxlocale} | |
2 | ||
3 | wxLocale class encapsulates all language-dependent settings and is a | |
4 | generalization of the C locale concept. | |
5 | ||
6 | In wxWindows this class manages message catalogs which contain the translations | |
7 | of the strings used to the current language. | |
8 | ||
9 | \perlnote{In wxPerl you can't use the '\_' function name, so | |
10 | the {\tt Wx::Locale} module can export the {\tt gettext} and | |
11 | {\tt gettext\_noop} under any given name. | |
12 | ||
13 | \begin{verbatim} | |
14 | # this imports gettext ( equivalent to Wx::GetTranslation | |
15 | # and gettext_noop ( a noop ) | |
16 | # into your module | |
17 | use Wx::Locale qw(:default); | |
18 | ||
19 | # .... | |
20 | ||
21 | # use the functions | |
22 | print gettext( ``Panic!'' ); | |
23 | ||
24 | button = Wx::Button->new( window, -1, gettext( ``Label'' ) ); | |
25 | \end{verbatim} | |
26 | ||
27 | If you need to translate a lot of strings, then adding gettext( ) around | |
28 | each one is a long task ( that is why \_( ) was introduced ), so just choose | |
29 | a shorter name for gettext: | |
30 | ||
31 | \begin{verbatim} | |
32 | # | |
33 | use Wx::Locale 'gettext' => 't', | |
34 | 'gettext_noop' => 'gettext_noop'; | |
35 | ||
36 | # ... | |
37 | ||
38 | # use the functions | |
39 | print t( ``Panic!!'' ); | |
40 | ||
41 | # ... | |
42 | \end{verbatim} | |
43 | }% | |
44 | ||
45 | \wxheading{Derived from} | |
46 | ||
47 | No base class | |
48 | ||
49 | \wxheading{See also} | |
50 | ||
51 | \helpref{Internationalization overview}{internationalization},\\ | |
52 | \helpref{Internat sample}{sampleinternat} | |
53 | ||
54 | \wxheading{Include files} | |
55 | ||
56 | <wx/intl.h> | |
57 | ||
58 | ||
59 | \latexignore{\rtfignore{\wxheading{Members}}} | |
60 | ||
61 | ||
62 | \membersection{Supported languages}\label{wxlanguage} | |
63 | ||
64 | The following wxLanguage constants may be used to specify the language | |
65 | in \helpref{Init}{wxlocaleinit} and are returned by | |
66 | \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage}: | |
67 | ||
68 | ||
69 | ||
70 | %% --- --- --- generated code begins here --- --- --- | |
71 | ||
72 | %% This enum is generated by misc/languages/genlang.py | |
73 | %% When making changes, please put them into misc/languages/langtabl.txt | |
74 | \begin{itemize}\itemsep=0pt | |
75 | \item wxLANGUAGE\_DEFAULT -- user's default language as obtained from the operating system | |
76 | \item wxLANGUAGE\_UNKNOWN -- returned by \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage} | |
77 | if it fails to detect the default language | |
78 | \item wxLANGUAGE\_USER\_DEFINED -- user defined languages' integer identifiers should start from | |
79 | this | |
80 | \item wxLANGUAGE\_ABKHAZIAN | |
81 | \item wxLANGUAGE\_AFAR | |
82 | \item wxLANGUAGE\_AFRIKAANS | |
83 | \item wxLANGUAGE\_ALBANIAN | |
84 | \item wxLANGUAGE\_AMHARIC | |
85 | \item wxLANGUAGE\_ARABIC | |
86 | \item wxLANGUAGE\_ARABIC\_ALGERIA | |
87 | \item wxLANGUAGE\_ARABIC\_BAHRAIN | |
88 | \item wxLANGUAGE\_ARABIC\_EGYPT | |
89 | \item wxLANGUAGE\_ARABIC\_IRAQ | |
90 | \item wxLANGUAGE\_ARABIC\_JORDAN | |
91 | \item wxLANGUAGE\_ARABIC\_KUWAIT | |
92 | \item wxLANGUAGE\_ARABIC\_LEBANON | |
93 | \item wxLANGUAGE\_ARABIC\_LIBYA | |
94 | \item wxLANGUAGE\_ARABIC\_MOROCCO | |
95 | \item wxLANGUAGE\_ARABIC\_OMAN | |
96 | \item wxLANGUAGE\_ARABIC\_QATAR | |
97 | \item wxLANGUAGE\_ARABIC\_SAUDI\_ARABIA | |
98 | \item wxLANGUAGE\_ARABIC\_SUDAN | |
99 | \item wxLANGUAGE\_ARABIC\_SYRIA | |
100 | \item wxLANGUAGE\_ARABIC\_TUNISIA | |
101 | \item wxLANGUAGE\_ARABIC\_UAE | |
102 | \item wxLANGUAGE\_ARABIC\_YEMEN | |
103 | \item wxLANGUAGE\_ARMENIAN | |
104 | \item wxLANGUAGE\_ASSAMESE | |
105 | \item wxLANGUAGE\_AYMARA | |
106 | \item wxLANGUAGE\_AZERI | |
107 | \item wxLANGUAGE\_AZERI\_CYRILLIC | |
108 | \item wxLANGUAGE\_AZERI\_LATIN | |
109 | \item wxLANGUAGE\_BASHKIR | |
110 | \item wxLANGUAGE\_BASQUE | |
111 | \item wxLANGUAGE\_BELARUSIAN | |
112 | \item wxLANGUAGE\_BENGALI | |
113 | \item wxLANGUAGE\_BHUTANI | |
114 | \item wxLANGUAGE\_BIHARI | |
115 | \item wxLANGUAGE\_BISLAMA | |
116 | \item wxLANGUAGE\_BRETON | |
117 | \item wxLANGUAGE\_BULGARIAN | |
118 | \item wxLANGUAGE\_BURMESE | |
119 | \item wxLANGUAGE\_CAMBODIAN | |
120 | \item wxLANGUAGE\_CATALAN | |
121 | \item wxLANGUAGE\_CHINESE | |
122 | \item wxLANGUAGE\_CHINESE\_SIMPLIFIED | |
123 | \item wxLANGUAGE\_CHINESE\_TRADITIONAL | |
124 | \item wxLANGUAGE\_CHINESE\_HONGKONG | |
125 | \item wxLANGUAGE\_CHINESE\_MACAU | |
126 | \item wxLANGUAGE\_CHINESE\_SINGAPORE | |
127 | \item wxLANGUAGE\_CHINESE\_TAIWAN | |
128 | \item wxLANGUAGE\_CORSICAN | |
129 | \item wxLANGUAGE\_CROATIAN | |
130 | \item wxLANGUAGE\_CZECH | |
131 | \item wxLANGUAGE\_DANISH | |
132 | \item wxLANGUAGE\_DUTCH | |
133 | \item wxLANGUAGE\_DUTCH\_BELGIAN | |
134 | \item wxLANGUAGE\_ENGLISH | |
135 | \item wxLANGUAGE\_ENGLISH\_UK | |
136 | \item wxLANGUAGE\_ENGLISH\_US | |
137 | \item wxLANGUAGE\_ENGLISH\_AUSTRALIA | |
138 | \item wxLANGUAGE\_ENGLISH\_BELIZE | |
139 | \item wxLANGUAGE\_ENGLISH\_BOTSWANA | |
140 | \item wxLANGUAGE\_ENGLISH\_CANADA | |
141 | \item wxLANGUAGE\_ENGLISH\_CARIBBEAN | |
142 | \item wxLANGUAGE\_ENGLISH\_DENMARK | |
143 | \item wxLANGUAGE\_ENGLISH\_EIRE | |
144 | \item wxLANGUAGE\_ENGLISH\_JAMAICA | |
145 | \item wxLANGUAGE\_ENGLISH\_NEW\_ZEALAND | |
146 | \item wxLANGUAGE\_ENGLISH\_PHILIPPINES | |
147 | \item wxLANGUAGE\_ENGLISH\_SOUTH\_AFRICA | |
148 | \item wxLANGUAGE\_ENGLISH\_TRINIDAD | |
149 | \item wxLANGUAGE\_ENGLISH\_ZIMBABWE | |
150 | \item wxLANGUAGE\_ESPERANTO | |
151 | \item wxLANGUAGE\_ESTONIAN | |
152 | \item wxLANGUAGE\_FAEROESE | |
153 | \item wxLANGUAGE\_FARSI | |
154 | \item wxLANGUAGE\_FIJI | |
155 | \item wxLANGUAGE\_FINNISH | |
156 | \item wxLANGUAGE\_FRENCH | |
157 | \item wxLANGUAGE\_FRENCH\_BELGIAN | |
158 | \item wxLANGUAGE\_FRENCH\_CANADIAN | |
159 | \item wxLANGUAGE\_FRENCH\_LUXEMBOURG | |
160 | \item wxLANGUAGE\_FRENCH\_MONACO | |
161 | \item wxLANGUAGE\_FRENCH\_SWISS | |
162 | \item wxLANGUAGE\_FRISIAN | |
163 | \item wxLANGUAGE\_GALICIAN | |
164 | \item wxLANGUAGE\_GEORGIAN | |
165 | \item wxLANGUAGE\_GERMAN | |
166 | \item wxLANGUAGE\_GERMAN\_AUSTRIAN | |
167 | \item wxLANGUAGE\_GERMAN\_BELGIUM | |
168 | \item wxLANGUAGE\_GERMAN\_LIECHTENSTEIN | |
169 | \item wxLANGUAGE\_GERMAN\_LUXEMBOURG | |
170 | \item wxLANGUAGE\_GERMAN\_SWISS | |
171 | \item wxLANGUAGE\_GREEK | |
172 | \item wxLANGUAGE\_GREENLANDIC | |
173 | \item wxLANGUAGE\_GUARANI | |
174 | \item wxLANGUAGE\_GUJARATI | |
175 | \item wxLANGUAGE\_HAUSA | |
176 | \item wxLANGUAGE\_HEBREW | |
177 | \item wxLANGUAGE\_HINDI | |
178 | \item wxLANGUAGE\_HUNGARIAN | |
179 | \item wxLANGUAGE\_ICELANDIC | |
180 | \item wxLANGUAGE\_INDONESIAN | |
181 | \item wxLANGUAGE\_INTERLINGUA | |
182 | \item wxLANGUAGE\_INTERLINGUE | |
183 | \item wxLANGUAGE\_INUKTITUT | |
184 | \item wxLANGUAGE\_INUPIAK | |
185 | \item wxLANGUAGE\_IRISH | |
186 | \item wxLANGUAGE\_ITALIAN | |
187 | \item wxLANGUAGE\_ITALIAN\_SWISS | |
188 | \item wxLANGUAGE\_JAPANESE | |
189 | \item wxLANGUAGE\_JAVANESE | |
190 | \item wxLANGUAGE\_KANNADA | |
191 | \item wxLANGUAGE\_KASHMIRI | |
192 | \item wxLANGUAGE\_KASHMIRI\_INDIA | |
193 | \item wxLANGUAGE\_KAZAKH | |
194 | \item wxLANGUAGE\_KERNEWEK | |
195 | \item wxLANGUAGE\_KINYARWANDA | |
196 | \item wxLANGUAGE\_KIRGHIZ | |
197 | \item wxLANGUAGE\_KIRUNDI | |
198 | \item wxLANGUAGE\_KONKANI | |
199 | \item wxLANGUAGE\_KOREAN | |
200 | \item wxLANGUAGE\_KURDISH | |
201 | \item wxLANGUAGE\_LAOTHIAN | |
202 | \item wxLANGUAGE\_LATIN | |
203 | \item wxLANGUAGE\_LATVIAN | |
204 | \item wxLANGUAGE\_LINGALA | |
205 | \item wxLANGUAGE\_LITHUANIAN | |
206 | \item wxLANGUAGE\_MACEDONIAN | |
207 | \item wxLANGUAGE\_MALAGASY | |
208 | \item wxLANGUAGE\_MALAY | |
209 | \item wxLANGUAGE\_MALAYALAM | |
210 | \item wxLANGUAGE\_MALAY\_BRUNEI\_DARUSSALAM | |
211 | \item wxLANGUAGE\_MALAY\_MALAYSIA | |
212 | \item wxLANGUAGE\_MALTESE | |
213 | \item wxLANGUAGE\_MANIPURI | |
214 | \item wxLANGUAGE\_MAORI | |
215 | \item wxLANGUAGE\_MARATHI | |
216 | \item wxLANGUAGE\_MOLDAVIAN | |
217 | \item wxLANGUAGE\_MONGOLIAN | |
218 | \item wxLANGUAGE\_NAURU | |
219 | \item wxLANGUAGE\_NEPALI | |
220 | \item wxLANGUAGE\_NEPALI\_INDIA | |
221 | \item wxLANGUAGE\_NORWEGIAN\_BOKMAL | |
222 | \item wxLANGUAGE\_NORWEGIAN\_NYNORSK | |
223 | \item wxLANGUAGE\_OCCITAN | |
224 | \item wxLANGUAGE\_ORIYA | |
225 | \item wxLANGUAGE\_OROMO | |
226 | \item wxLANGUAGE\_PASHTO | |
227 | \item wxLANGUAGE\_POLISH | |
228 | \item wxLANGUAGE\_PORTUGUESE | |
229 | \item wxLANGUAGE\_PORTUGUESE\_BRAZILIAN | |
230 | \item wxLANGUAGE\_PUNJABI | |
231 | \item wxLANGUAGE\_QUECHUA | |
232 | \item wxLANGUAGE\_RHAETO\_ROMANCE | |
233 | \item wxLANGUAGE\_ROMANIAN | |
234 | \item wxLANGUAGE\_RUSSIAN | |
235 | \item wxLANGUAGE\_RUSSIAN\_UKRAINE | |
236 | \item wxLANGUAGE\_SAMOAN | |
237 | \item wxLANGUAGE\_SANGHO | |
238 | \item wxLANGUAGE\_SANSKRIT | |
239 | \item wxLANGUAGE\_SCOTS\_GAELIC | |
240 | \item wxLANGUAGE\_SERBIAN | |
241 | \item wxLANGUAGE\_SERBIAN\_CYRILLIC | |
242 | \item wxLANGUAGE\_SERBIAN\_LATIN | |
243 | \item wxLANGUAGE\_SERBO\_CROATIAN | |
244 | \item wxLANGUAGE\_SESOTHO | |
245 | \item wxLANGUAGE\_SETSWANA | |
246 | \item wxLANGUAGE\_SHONA | |
247 | \item wxLANGUAGE\_SINDHI | |
248 | \item wxLANGUAGE\_SINHALESE | |
249 | \item wxLANGUAGE\_SISWATI | |
250 | \item wxLANGUAGE\_SLOVAK | |
251 | \item wxLANGUAGE\_SLOVENIAN | |
252 | \item wxLANGUAGE\_SOMALI | |
253 | \item wxLANGUAGE\_SPANISH | |
254 | \item wxLANGUAGE\_SPANISH\_ARGENTINA | |
255 | \item wxLANGUAGE\_SPANISH\_BOLIVIA | |
256 | \item wxLANGUAGE\_SPANISH\_CHILE | |
257 | \item wxLANGUAGE\_SPANISH\_COLOMBIA | |
258 | \item wxLANGUAGE\_SPANISH\_COSTA\_RICA | |
259 | \item wxLANGUAGE\_SPANISH\_DOMINICAN\_REPUBLIC | |
260 | \item wxLANGUAGE\_SPANISH\_ECUADOR | |
261 | \item wxLANGUAGE\_SPANISH\_EL\_SALVADOR | |
262 | \item wxLANGUAGE\_SPANISH\_GUATEMALA | |
263 | \item wxLANGUAGE\_SPANISH\_HONDURAS | |
264 | \item wxLANGUAGE\_SPANISH\_MEXICAN | |
265 | \item wxLANGUAGE\_SPANISH\_MODERN | |
266 | \item wxLANGUAGE\_SPANISH\_NICARAGUA | |
267 | \item wxLANGUAGE\_SPANISH\_PANAMA | |
268 | \item wxLANGUAGE\_SPANISH\_PARAGUAY | |
269 | \item wxLANGUAGE\_SPANISH\_PERU | |
270 | \item wxLANGUAGE\_SPANISH\_PUERTO\_RICO | |
271 | \item wxLANGUAGE\_SPANISH\_URUGUAY | |
272 | \item wxLANGUAGE\_SPANISH\_US | |
273 | \item wxLANGUAGE\_SPANISH\_VENEZUELA | |
274 | \item wxLANGUAGE\_SUNDANESE | |
275 | \item wxLANGUAGE\_SWAHILI | |
276 | \item wxLANGUAGE\_SWEDISH | |
277 | \item wxLANGUAGE\_SWEDISH\_FINLAND | |
278 | \item wxLANGUAGE\_TAGALOG | |
279 | \item wxLANGUAGE\_TAJIK | |
280 | \item wxLANGUAGE\_TAMIL | |
281 | \item wxLANGUAGE\_TATAR | |
282 | \item wxLANGUAGE\_TELUGU | |
283 | \item wxLANGUAGE\_THAI | |
284 | \item wxLANGUAGE\_TIBETAN | |
285 | \item wxLANGUAGE\_TIGRINYA | |
286 | \item wxLANGUAGE\_TONGA | |
287 | \item wxLANGUAGE\_TSONGA | |
288 | \item wxLANGUAGE\_TURKISH | |
289 | \item wxLANGUAGE\_TURKMEN | |
290 | \item wxLANGUAGE\_TWI | |
291 | \item wxLANGUAGE\_UIGHUR | |
292 | \item wxLANGUAGE\_UKRAINIAN | |
293 | \item wxLANGUAGE\_URDU | |
294 | \item wxLANGUAGE\_URDU\_INDIA | |
295 | \item wxLANGUAGE\_URDU\_PAKISTAN | |
296 | \item wxLANGUAGE\_UZBEK | |
297 | \item wxLANGUAGE\_UZBEK\_CYRILLIC | |
298 | \item wxLANGUAGE\_UZBEK\_LATIN | |
299 | \item wxLANGUAGE\_VIETNAMESE | |
300 | \item wxLANGUAGE\_VOLAPUK | |
301 | \item wxLANGUAGE\_WELSH | |
302 | \item wxLANGUAGE\_WOLOF | |
303 | \item wxLANGUAGE\_XHOSA | |
304 | \item wxLANGUAGE\_YIDDISH | |
305 | \item wxLANGUAGE\_YORUBA | |
306 | \item wxLANGUAGE\_ZHUANG | |
307 | \item wxLANGUAGE\_ZULU | |
308 | \end{itemize} | |
309 | ||
310 | %% --- --- --- generated code ends here --- --- --- | |
311 | ||
312 | ||
313 | ||
314 | ||
315 | \membersection{wxLocale::wxLocale}\label{wxlocaledefctor} | |
316 | ||
317 | \func{}{wxLocale}{\void} | |
318 | ||
319 | This is the default constructor and it does nothing to initialize the object: | |
320 | \helpref{Init()}{wxlocaleinit} must be used to do that. | |
321 | ||
322 | \func{}{wxLocale}{\param{int }{language}, \param{int }{flags = | |
323 | wxLOCALE\_LOAD\_DEFAULT | wxLOCALE\_CONV\_ENCODING}} | |
324 | ||
325 | See \helpref{Init()}{wxlocaleinit} for parameters description. | |
326 | ||
327 | \func{}{wxLocale}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = true}, \param{bool }{bConvertEncoding = false}} | |
328 | ||
329 | See \helpref{Init()}{wxlocaleinit} for parameters description. | |
330 | ||
331 | The call of this function has several global side effects which you should | |
332 | understand: first of all, the application locale is changed - note that this | |
333 | will affect many of standard C library functions such as printf() or strftime(). | |
334 | Second, this wxLocale object becomes the new current global locale for the | |
335 | application and so all subsequent calls to wxGetTranslation() will try to | |
336 | translate the messages using the message catalogs for this locale. | |
337 | ||
338 | ||
339 | \membersection{wxLocale::\destruct{wxLocale}}\label{wxlocaledtor} | |
340 | ||
341 | \func{}{\destruct{wxLocale}}{\void} | |
342 | ||
343 | The destructor, like the constructor, also has global side effects: the previously | |
344 | set locale is restored and so the changes described in | |
345 | \helpref{Init}{wxlocaleinit} documentation are rolled back. | |
346 | ||
347 | \membersection{wxLocale::AddCatalog}\label{wxlocaleaddcatalog} | |
348 | ||
349 | \func{bool}{AddCatalog}{\param{const char }{*szDomain}} | |
350 | ||
351 | Add a catalog for use with the current locale: it is searched for in standard | |
352 | places (current directory first, then the system one), but you may also prepend | |
353 | additional directories to the search path with | |
354 | \helpref{AddCatalogLookupPathPrefix()}{wxlocaleaddcataloglookuppathprefix}. | |
355 | ||
356 | All loaded catalogs will be used for message lookup by GetString() for the | |
357 | current locale. | |
358 | ||
359 | Returns true if catalog was successfully loaded, false otherwise (which might | |
360 | mean that the catalog is not found or that it isn't in the correct format). | |
361 | ||
362 | \membersection{wxLocale::AddCatalogLookupPathPrefix}\label{wxlocaleaddcataloglookuppathprefix} | |
363 | ||
364 | \func{void}{AddCatalogLookupPathPrefix}{\param{const wxString\& }{prefix}} | |
365 | ||
366 | Add a prefix to the catalog lookup path: the message catalog files will be | |
367 | looked up under prefix/<lang>/LC\_MESSAGES, prefix/LC\_MESSAGES and prefix | |
368 | (in this order). | |
369 | ||
370 | This only applies to subsequent invocations of AddCatalog()! | |
371 | ||
372 | \membersection{wxLocale::AddLanguage}\label{wxlocaleaddlanguage} | |
373 | ||
374 | \func{static void}{AddLanguage}{\param{const wxLanguageInfo\& }{info}} | |
375 | ||
376 | Adds custom, user-defined language to the database of known languages. This | |
377 | database is used in conjunction with the first form of | |
378 | \helpref{Init}{wxlocaleinit}. | |
379 | ||
380 | wxLanguageInfo is defined as follows: | |
381 | ||
382 | \begin{verbatim} | |
383 | struct WXDLLEXPORT wxLanguageInfo | |
384 | { | |
385 | int Language; // wxLanguage id | |
386 | wxString CanonicalName; // Canonical name, e.g. fr_FR | |
387 | #ifdef __WIN32__ | |
388 | wxUint32 WinLang, WinSublang; // Win32 language identifiers | |
389 | // (LANG_xxxx, SUBLANG_xxxx) | |
390 | #endif | |
391 | wxString Description; // human-readable name of the language | |
392 | }; | |
393 | \end{verbatim} | |
394 | ||
395 | ||
396 | {\it Language} should be greater than wxLANGUAGE\_USER\_DEFINED. | |
397 | ||
398 | \perlnote{In wxPerl Wx::LanguageInfo has only one method:\par | |
399 | Wx::LanguageInfo->new( language, canonicalName, WinLang, WinSubLang, Description )} | |
400 | ||
401 | \membersection{wxLocale::FindLanguageInfo}{wxlocalefindlanguageinfo} | |
402 | ||
403 | \constfunc{static wxLanguageInfo *}{FindLanguageInfo}{\param{const wxString\& }{locale}} | |
404 | ||
405 | This function may be used to find the language description structure for the | |
406 | given locale, specified either as a two letter ISO language code (for example, | |
407 | "pt"), a language code followed by the country code ("pt\_BR") or a full, human | |
408 | readable, language description ("Portuguese-Brazil"). | |
409 | ||
410 | Returns the information for the given language or {\tt NULL} if this language | |
411 | is unknown. Note that even if the returned pointer is valid, the caller should | |
412 | {\it not} delete it. | |
413 | ||
414 | \wxheading{See also} | |
415 | ||
416 | \helpref{GetLanguageInfo}{wxlocalegetlanguageinfo} | |
417 | ||
418 | \membersection{wxLocale::GetCanonicalName}\label{wxlocalegetcanonicalname} | |
419 | ||
420 | \constfunc{wxString}{GetSysName}{\void} | |
421 | ||
422 | Returns the canonical form of current locale name. Canonical form is the | |
423 | one that is used on UNIX systems: it is a two- or five-letter string in xx or | |
424 | xx\_YY format, where xx is ISO 639 code of language and YY is ISO 3166 code of | |
425 | the country. Examples are "en", "en\_GB", "en\_US" or "fr\_FR". | |
426 | ||
427 | This form is internally used when looking up message catalogs. | |
428 | ||
429 | Compare \helpref{GetSysName}{wxlocalegetsysname}. | |
430 | ||
431 | ||
432 | ||
433 | \membersection{wxLocale::GetLanguage}\label{wxlocalegetlanguage} | |
434 | ||
435 | \constfunc{int}{GetLanguage}{\void} | |
436 | ||
437 | Returns \helpref{wxLanguage}{wxlanguage} constant of current language. | |
438 | Note that you can call this function only if you used the form of | |
439 | \helpref{Init}{wxlocaleinit} that takes wxLanguage argument. | |
440 | ||
441 | \membersection{wxLocale::GetLanguageInfo}\label{wxlocalegetlanguageinfo} | |
442 | ||
443 | \constfunc{static wxLanguageInfo *}{GetLanguageInfo}{\param{int }{lang}} | |
444 | ||
445 | Returns a pointer to wxLanguageInfo structure containing information about the | |
446 | given language or {\tt NULL} if this language is unknown. Note that even if the | |
447 | returned pointer is valid, the caller should {\it not} delete it. | |
448 | ||
449 | See \helpref{AddLanguage}{wxlocaleaddlanguage} for the wxLanguageInfo | |
450 | description. | |
451 | ||
452 | \membersection{wxLocale::GetLanguageName}\label{wxlocalegetlanguagename} | |
453 | ||
454 | \constfunc{static wxString}{GetLanguageName}{\param{int }{lang}} | |
455 | ||
456 | Returns English name of the given language or empty string if this | |
457 | language is unknown. | |
458 | ||
459 | ||
460 | \membersection{wxLocale::GetLocale}\label{wxlocalegetlocale} | |
461 | ||
462 | \constfunc{const char*}{GetLocale}{\void} | |
463 | ||
464 | Returns the locale name as passed to the constructor or | |
465 | \helpref{Init()}{wxlocaleinit}. This is full, human-readable name, | |
466 | e.g. "English" or "French". | |
467 | ||
468 | ||
469 | \membersection{wxLocale::GetName}\label{wxlocalegetname} | |
470 | ||
471 | \constfunc{const wxString\&}{GetName}{\void} | |
472 | ||
473 | Returns the current short name for the locale (as given to the constructor or | |
474 | the Init() function). | |
475 | ||
476 | \membersection{wxLocale::GetString}\label{wxlocalegetstring} | |
477 | ||
478 | \constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szDomain = NULL}} | |
479 | ||
480 | \constfunc{const char*}{GetString}{\param{const char }{*szOrigString}, \param{const char }{*szOrigString2}, \param{size\_t }{n}, \param{const char }{*szDomain = NULL}} | |
481 | ||
482 | Retrieves the translation for a string in all loaded domains unless the szDomain | |
483 | parameter is specified (and then only this catalog/domain is searched). | |
484 | ||
485 | Returns original string if translation is not available | |
486 | (in this case an error message is generated the first time | |
487 | a string is not found; use \helpref{wxLogNull}{wxlogoverview} to suppress it). | |
488 | ||
489 | The second form is used when retrieving translation of string that has | |
490 | different singular and plural form in English or different plural forms in some | |
491 | other language. It takes two extra arguments: \arg{szOrigString} | |
492 | parameter must contain the singular form of the string to be converted. | |
493 | It is also used as the key for the search in the catalog. | |
494 | The \arg{szOrigString2} parameter is the plural form (in English). | |
495 | The parameter \arg{n} is used to determine the plural form. If no | |
496 | message catalog is found \arg{szOrigString} is returned if `n == 1', | |
497 | otherwise \arg{szOrigString2}. | |
498 | See \urlref{GNU gettext manual}{http://www.gnu.org/manual/gettext/html\_chapter/gettext\_10.html\#SEC150} for additional information on plural forms handling. | |
499 | ||
500 | \wxheading{Remarks} | |
501 | ||
502 | Domains are searched in the last to first order, i.e. catalogs | |
503 | added later override those added before. | |
504 | ||
505 | \membersection{wxLocale::GetSysName}\label{wxlocalegetsysname} | |
506 | ||
507 | \constfunc{wxString}{GetSysName}{\void} | |
508 | ||
509 | Returns current platform-specific locale name as passed to setlocale(). | |
510 | ||
511 | Compare \helpref{GetCanonicalName}{wxlocalegetcanonicalname}. | |
512 | ||
513 | ||
514 | \membersection{wxLocale::GetSystemEncoding}\label{wxlocalegetsystemencoding} | |
515 | ||
516 | \constfunc{static wxFontEncoding}{GetSystemEncoding}{\void} | |
517 | ||
518 | Tries to detect the user's default font encoding. | |
519 | Returns \helpref{wxFontEncoding}{wxfont} value or | |
520 | {\bf wxFONTENCODING\_SYSTEM} if it couldn't be determined. | |
521 | ||
522 | \membersection{wxLocale::GetSystemEncodingName}\label{wxlocalegetsystemencodingname} | |
523 | ||
524 | \constfunc{static wxString}{GetSystemEncodingName}{\void} | |
525 | ||
526 | Tries to detect the name of the user's default font encoding. This string isn't | |
527 | particularly useful for the application as its form is platform-dependent and | |
528 | so you should probably use | |
529 | \helpref{GetSystemEncoding}{wxlocalegetsystemencoding} instead. | |
530 | ||
531 | Returns a user-readable string value or an empty string if it couldn't be | |
532 | determined. | |
533 | ||
534 | \membersection{wxLocale::GetSystemLanguage}\label{wxlocalegetsystemlanguage} | |
535 | ||
536 | \constfunc{static int}{GetSystemLanguage}{\void} | |
537 | ||
538 | Tries to detect the user's default language setting. | |
539 | Returns \helpref{wxLanguage}{wxlanguage} value or | |
540 | {\bf wxLANGUAGE\_UNKNOWN} if the language-guessing algorithm failed. | |
541 | ||
542 | ||
543 | \membersection{wxLocale::Init}\label{wxlocaleinit} | |
544 | ||
545 | ||
546 | \func{bool}{Init}{\param{int }{language = wxLANGUAGE\_DEFAULT}, \param{int }{flags = | |
547 | wxLOCALE\_LOAD\_DEFAULT | wxLOCALE\_CONV\_ENCODING}} | |
548 | ||
549 | \func{bool}{Init}{\param{const char }{*szName}, \param{const char }{*szShort = NULL}, \param{const char }{*szLocale = NULL}, \param{bool }{bLoadDefault = true}, \param{bool }{bConvertEncoding = false}} | |
550 | ||
551 | The second form is deprecated, use the first one unless you know what you are | |
552 | doing. | |
553 | ||
554 | ||
555 | \wxheading{Parameters} | |
556 | ||
557 | \docparam{language}{\helpref{wxLanguage}{wxlanguage} identifier of the locale. | |
558 | wxLANGUAGE\_DEFAULT has special meaning -- wxLocale will use system's default | |
559 | language (see \helpref{GetSystemLanguage}{wxlocalegetsystemlanguage}).} | |
560 | ||
561 | \docparam{flags}{Combination of the following: | |
562 | \begin{twocollist}\itemsep=0pt | |
563 | \twocolitem{\windowstyle{wxLOCALE\_LOAD\_DEFAULT}}{Load the message catalog | |
564 | for the given locale containing the translations of standard wxWindows messages | |
565 | automatically.} | |
566 | \twocolitem{\windowstyle{wxLOCALE\_CONV\_ENCODING}}{Automatically convert message | |
567 | catalogs to platform's default encoding. Note that it will do only basic | |
568 | conversion between well-known pair like iso8859-1 and windows-1252 or | |
569 | iso8859-2 and windows-1250. See \helpref{Writing non-English applications}{nonenglishoverview} for detailed | |
570 | description of this behaviour. Note that this flag is meaningless in Unicode build.} | |
571 | \end{twocollist} | |
572 | } | |
573 | ||
574 | \docparam{szName}{The name of the locale. Only used in diagnostic messages.} | |
575 | ||
576 | \docparam{szShort}{The standard 2 letter locale abbreviation and is used as the | |
577 | directory prefix when looking for the message catalog files.} | |
578 | ||
579 | \docparam{szLocale}{The parameter for the call to setlocale(). Note that it is | |
580 | platform-specific.} | |
581 | ||
582 | \docparam{bLoadDefault}{May be set to false to prevent loading of the message catalog | |
583 | for the given locale containing the translations of standard wxWindows messages. | |
584 | This parameter would be rarely used in normal circumstances.} | |
585 | ||
586 | \docparam{bConvertEncoding}{May be set to true to do automatic conversion of message | |
587 | catalogs to platform's native encoding. Note that it will do only basic | |
588 | conversion between well-known pair like iso8859-1 and windows-1252 or | |
589 | iso8859-2 and windows-1250. | |
590 | See \helpref{Writing non-English applications}{nonenglishoverview} for detailed | |
591 | description of this behaviour.} | |
592 | ||
593 | ||
594 | The call of this function has several global side effects which you should | |
595 | understand: first of all, the application locale is changed - note that this | |
596 | will affect many of standard C library functions such as printf() or strftime(). | |
597 | Second, this wxLocale object becomes the new current global locale for the | |
598 | application and so all subsequent calls to wxGetTranslation() will try to | |
599 | translate the messages using the message catalogs for this locale. | |
600 | ||
601 | Returns true on success or false if the given locale couldn't be set. | |
602 | ||
603 | \membersection{wxLocale::IsLoaded}\label{wxlocaleisloaded} | |
604 | ||
605 | \constfunc{bool}{IsLoaded}{\param{const char* }{domain}} | |
606 | ||
607 | Check if the given catalog is loaded, and returns true if it is. | |
608 | ||
609 | According to GNU gettext tradition, each catalog | |
610 | normally corresponds to 'domain' which is more or less the application name. | |
611 | ||
612 | See also: \helpref{AddCatalog}{wxlocaleaddcatalog} | |
613 | ||
614 | \membersection{wxLocale::IsOk}\label{wxlocaleisok} | |
615 | ||
616 | \constfunc{bool}{IsOk}{\void} | |
617 | ||
618 | Returns true if the locale could be set successfully. | |
619 |