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