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