Localization library - cppreference.com

From cppreference.com

The locale facility includes internationalization support for character classification and string collation, numeric, monetary, and date/time formatting and parsing, and message retrieval. Locale settings control the behavior of stream I/O, regular expression library, and other components of the C++ standard library.

Locales and facets

Defined in header

<locale>

Locales

locale

set of polymorphic facets that encapsulate cultural differences
(class)

[edit]

use_facet

obtains a facet from a locale
(function template)

[edit]

has_facet

checks if a locale implements a specific facet
(function template)

[edit]

Facet category base classes

ctype_base

defines character classification categories
(class)

[edit]

codecvt_base

defines character conversion errors
(class)

[edit]

messages_base

defines messages catalog type
(class)

[edit]

time_base

defines date format constants
(class)

[edit]

money_base

defines monetary formatting patterns
(class)

[edit]

ctype facets

ctype

defines character classification tables
(class template)

[edit]

ctype_byname

represents the system-supplied

std::ctype

for the named locale
(class template)

[edit]

ctype<char>

specialization of

std::ctype

for type char
(class template specialization)

[edit]

codecvt

converts between character encodings, including UTF-8, UTF-16, UTF-32
(class template)

[edit]

codecvt_byname

represents the system-supplied

std::codecvt

for the named locale
(class template)

[edit]

numeric facets

num_get

parses numeric values from an input character sequence
(class template)

[edit]

num_put

formats numeric values for output as character sequence
(class template)

[edit]

numpunct

defines numeric punctuation rules
(class template)

[edit]

numpunct_byname

represents the system-supplied

std::numpunct

for the named locale
(class template)

[edit]

collate facets

collate

defines lexicographical comparison and hashing of strings
(class template)

[edit]

collate_byname

represents the system-supplied

std::collate

for the named locale
(class template)

[edit]

time facets

time_get

parses time/date values from an input character sequence into

std::tm

(class template)

[edit]

time_get_byname

represents the system-supplied

std::time_get

for the named locale
(class template)

[edit]

time_put

formats contents of

std::tm

for output as character sequence
(class template)

[edit]

time_put_byname

represents the system-supplied

std::time_put

for the named locale
(class template)

[edit]

monetary facets

money_get

parses and constructs a monetary value from an input character sequence
(class template)

[edit]

money_put

formats a monetary value for output as a character sequence
(class template)

[edit]

moneypunct

defines monetary formatting parameters used by

std::money_get

and

std::money_put

(class template)

[edit]

moneypunct_byname

represents the system-supplied

std::moneypunct

for the named locale
(class template)

[edit]

messages facets

messages

implements retrieval of strings from message catalogs
(class template)

[edit]

messages_byname

represents the system-supplied

std::messages

for the named locale
(class template)

[edit]

Character classification and conversion

Defined in header

<locale>

Character classification

isspace(std::locale)

checks if a character is classified as whitespace by a locale
(function template)

[edit]

isblank(std::locale)

(C++11)

checks if a character is classified as a blank character by a locale
(function template)

[edit]

iscntrl(std::locale)

checks if a character is classified as a control character by a locale
(function template)

[edit]

isupper(std::locale)

checks if a character is classified as uppercase by a locale
(function template)

[edit]

islower(std::locale)

checks if a character is classified as lowercase by a locale
(function template)

[edit]

isalpha(std::locale)

checks if a character is classified as alphabetic by a locale
(function template)

[edit]

isdigit(std::locale)

checks if a character is classified as a digit by a locale
(function template)

[edit]

ispunct(std::locale)

checks if a character is classified as punctuation by a locale
(function template)

[edit]

isxdigit(std::locale)

checks if a character is classified as a hexadecimal digit by a locale
(function template)

[edit]

isalnum(std::locale)

checks if a character is classified as alphanumeric by a locale
(function template)

[edit]

isprint(std::locale)

checks if a character is classified as printable by a locale
(function template)

[edit]

isgraph(std::locale)

checks if a character is classified as graphical by a locale
(function template)

[edit]

Character conversions

toupper(std::locale)

converts a character to uppercase using the ctype facet of a locale
(function template)

[edit]

tolower(std::locale)

converts a character to lowercase using the ctype facet of a locale
(function template)

[edit]

String and stream conversions

wstring_convert

(C++11)(deprecated in C++17)(removed in C++26)

performs conversions between a wide string and a byte string
(class template)

[edit]

wbuffer_convert

(C++11)(deprecated in C++17)(removed in C++26)

performs conversion between a byte stream buffer and a wide stream buffer
(class template)

[edit]

Locale-independent unicode conversion facets

(C++11)(deprecated in C++17)(removed in C++26)

converts between UTF-8 and UCS-2/UCS-4
(class template)

[edit]

(C++11)(deprecated in C++17)(removed in C++26)

converts between UTF-16 and UCS-2/UCS-4
(class template)

[edit]

(C++11)(deprecated in C++17)(removed in C++26)

converts between UTF-8 and UTF-16
(class template)

[edit]

(C++11)(deprecated in C++17)(removed in C++26)

tags to alter behavior of the standard codecvt facets
(enum)

[edit]

(until C++26)C library locales

See also