class
<locale>
std::locale
Locale class
A locale object encapsulates a set of features that are culture-specific, which can be used by programs to enhance international portability (see header <locale> for more info).
On construction of a locale object, the localization engine initializes all the facets associated with it (if necessary) and makes them available to the program.
locale objects are generally constructed from a name (generally, the same as with the <clocale>
function setlocale), or from another locale object. They can also mix facets from more than one locale object.
Every program has a single locale object which is its global locale. On start, this is the classic locale, but this can be changed by calling locale::global. This global locale is selected by all default-constructed locale objects.
The global locale also affects the C locale (see function setlocale): When a new named global locale is set with locale::global, the C locale is also modified.
locale objects can be used to access their associated facets in order to use their formatting features. They can also be imbued individually to specific stream objects (such as cin, cout or a file stream) by calling the stream's imbue member function.
See header <locale>
for more information on locales and facets.
Member types
- category
- Locale category (public member type)
- facet
- Locale facet (public member class)
- id
- Locale facet id (public member class)
Member functions
- (constructor)
- Locale constructor (public member function)
- (destructor)
- Locale destructor (public member function)
- classic
- Get classic locale [static] (public static member function)
- combine
- Construct copy of locale modifying one facet (public member function)
- global
- Set global locale [static] (public static member function)
- name
- Get locale name (public member function)
- operator!=
- Compare locales (public member function)
- operator()
- Compare strings using locale (public member function)
- operator=
- Copy locale (public member function)
- operator==
- Compare locales (public member function)