]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/xlocale.tex
interface headers reviewed
[wxWidgets.git] / docs / latex / wx / xlocale.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: xlocale.tex
3 %% Purpose: wxXLocale documentation
4 %% Author: Vadim Zeitlin
5 %% Created: 2008-02-10
6 %% RCS-ID: $Id: cmdlpars.tex 49199 2007-10-17 17:32:16Z VZ $
7 %% Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 %% License: wxWindows license
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11 \section{\class{wxXLocale}}\label{wxxlocale}
12
13 \subsection{Introduction}
14
15 This class represents a locale object used by so-called xlocale API. Unlike
16 \helpref{wxLocale}{wxlocale} it doesn't provide any non-trivial operations but
17 simply provides a portable wrapper for POSIX \texttt{locale\_t} type. It exists
18 solely to be provided as an argument to various \texttt{wxFoo\_l()} functions
19 which are the extensions of the standard locale-dependent functions (hence the
20 name xlocale). These functions do exactly the same thing as the corresponding
21 standard \texttt{foo()} except that instead of using the global program locale
22 they use the provided wxXLocale object. For example, if the user runs the
23 program in French locale, the standard \texttt{printf()} function will output
24 floating point numbers using decimal comma instead of decimal period. If the
25 program needs to format a floating-point number in a standard format it can
26 use \texttt{wxPrintf\_l(wxXLocale::GetCLocale(), "\%g", number)} to do it.
27 Conversely, if a program wanted to output the number in French locale, even if
28 the current locale is different, it could use wxXLocale(wxLANGUAGE\_FRENCH).
29
30 \subsection{Availability}
31
32 This class is fully implemented only under the platforms where xlocale POSIX
33 API or equivalent is available. Currently the xlocale API is available under
34 most of the recent Unix systems (including Linux, various BSD and Mac OS X) and
35 Microsoft Visual C++ standard library provides a similar API starting from
36 version 8 (Visual Studio 2005).
37
38 If neither POSIX API nor Microsoft proprietary equivalent are available, this
39 class is still available but works in degraded mode: the only supported locale
40 is the C one and attempts to create wxXLocale object for any other locale will
41 fail. You can use the preprocessor macro \texttt{wxHAS\_XLOCALE\_SUPPORT} to
42 test if full xlocale API is available or only skeleton C locale support is
43 present.
44
45 Notice that wxXLocale is new in wxWidgets 2.9.0 and is not compiled in if
46 \texttt{wxUSE\_XLOCALE} was set to $0$ during the library compilation.
47
48 \subsection{Locale-dependent functions}
49
50 Currently the following \texttt{\_l}-functions are available:
51 \begin{itemize}
52 \item Character classification functions: \texttt{wxIsxxx\_l()}, e.g.
53 \texttt{wxIsalpha\_l()}, \texttt{wxIslower\_l()} and all the others.
54 \item Character transformation functions: \texttt{wxTolower\_l()} and
55 \texttt{wxToupper\_l()}
56 \end{itemize}
57
58 We hope to provide many more functions (covering numbers, time and formatted
59 IO) in the near future.
60
61
62 \wxheading{Derived from}
63
64 No base class
65
66 \wxheading{See also}
67
68 \helpref{wxLocale}{wxlocale}
69
70 \wxheading{Include files}
71
72 <wx/intl.h>
73
74 \wxheading{Library}
75
76 \helpref{wxBase}{librarieslist}
77
78
79 \latexignore{\rtfignore{\wxheading{Members}}}
80
81 \membersection{wxXLocale::wxXLocale}\label{wxxlocalector}
82
83 \func{}{wxLocale}{\void}
84
85 Creates an uninitialized locale object, \helpref{IsOk}{wxxlocaleisok} method
86 will return false.
87
88 \func{}{wxLocale}{\param{wxLanguage}{ lang}}
89
90 Creates the locale object corresponding to the specified language.
91
92 \func{}{wxLocale}{\param{const char *}{loc}}
93
94 Creates the locale object corresponding to the specified locale string. The
95 locale string is system-dependent, use constructor taking wxLanguage for better
96 portability.
97
98
99 \membersection{wxXLocale::GetCLocale}\label{wxxlocalegetclocale}
100
101 \func{static wxXLocale\& }{GetCLocale}{\void}
102
103 Returns the global object representing the "C" locale. For an even shorter
104 access to this object a global \texttt{wxCLocale} variable (implemented as a
105 macro) is provided and can be used instead of calling this method.
106
107
108 \membersection{wxXLocale::IsOk}\label{wxxlocaleisok}
109
110 \constfunc{bool}{IsOk}{\void}
111
112 Returns \true if this object is initialized, i.e. represents a valid locale or
113 \false otherwise.
114