Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Message Formatting (translation)

This module provides message translation functionality, i.e. More...

Collaboration diagram for Message Formatting (translation):

Modules

 I/O Stream manipulators
 

Namespaces

 boost::locale::gnu_gettext
 This namespace holds classes that provide GNU Gettext message catalogs support.
 
 boost::locale::as
 This namespace includes all manipulators that can be used on IO streams.
 

Classes

struct  boost::locale::gnu_gettext::messages_info
 This structure holds all information required for creating gnu-gettext message catalogs,. More...
 
struct  boost::locale::gnu_gettext::messages_info::domain
 This type represents GNU Gettext domain name for the messages. More...
 
class  boost::locale::message_format< CharType >
 This facet provides message formatting abilities. More...
 
class  boost::locale::basic_message< CharType >
 This class represents a message that can be converted to a specific locale message. More...
 

Typedefs

typedef CharType boost::locale::message_format< CharType >::char_type
 Character type. More...
 
typedef std::basic_string
< CharType > 
boost::locale::message_format< CharType >::string_type
 String type. More...
 
typedef CharType boost::locale::basic_message< CharType >::char_type
 The character this message object is used with. More...
 
typedef std::basic_string
< char_type > 
boost::locale::basic_message< CharType >::string_type
 The string type this object can be used with. More...
 
typedef message_format< char_type > boost::locale::basic_message< CharType >::facet_type
 The type of the facet the messages are fetched with. More...
 
typedef basic_message< char > boost::locale::message
 Convenience typedef for char. More...
 
typedef basic_message< wchar_t > boost::locale::wmessage
 Convenience typedef for wchar_t. More...
 

Functions

 boost::locale::message_format< CharType >::message_format (size_t refs=0)
 Default constructor. More...
 
virtual char_type const * boost::locale::message_format< CharType >::get (int domain_id, char_type const *context, char_type const *id) const =0
 This function returns a pointer to the string for a message defined by a context and identification string id. More...
 
virtual char_type const * boost::locale::message_format< CharType >::get (int domain_id, char_type const *context, char_type const *single_id, int n) const =0
 This function returns a pointer to the string for a plural message defined by a context and identification string single_id. More...
 
virtual int boost::locale::message_format< CharType >::domain (std::string const &domain) const =0
 Convert a string that defines domain to the integer id used by get functions. More...
 
virtual char_type const * boost::locale::message_format< CharType >::convert (char_type const *msg, string_type &buffer) const =0
 Convert the string msg to target locale's encoding. More...
 
virtual boost::locale::message_format< CharType >::~message_format ()
 
 boost::locale::basic_message< CharType >::basic_message ()
 Create default empty message. More...
 
 boost::locale::basic_message< CharType >::basic_message (char_type const *id)
 Create a simple message from 0 terminated string. More...
 
 boost::locale::basic_message< CharType >::basic_message (char_type const *single, char_type const *plural, int n)
 Create a simple plural form message from 0 terminated strings. More...
 
 boost::locale::basic_message< CharType >::basic_message (char_type const *context, char_type const *id)
 Create a simple message from 0 terminated strings, with context information. More...
 
 boost::locale::basic_message< CharType >::basic_message (char_type const *context, char_type const *single, char_type const *plural, int n)
 Create a simple plural form message from 0 terminated strings, with context. More...
 
 boost::locale::basic_message< CharType >::basic_message (string_type const &id)
 Create a simple message from a string. More...
 
 boost::locale::basic_message< CharType >::basic_message (string_type const &single, string_type const &plural, int number)
 Create a simple plural form message from strings. More...
 
 boost::locale::basic_message< CharType >::basic_message (string_type const &context, string_type const &id)
 Create a simple message from a string with context. More...
 
 boost::locale::basic_message< CharType >::basic_message (string_type const &context, string_type const &single, string_type const &plural, int number)
 Create a simple plural form message from strings. More...
 
 boost::locale::basic_message< CharType >::basic_message (basic_message const &other)
 Copy an object. More...
 
basic_message const & boost::locale::basic_message< CharType >::operator= (basic_message const &other)
 Assign other message object to this one. More...
 
void boost::locale::basic_message< CharType >::swap (basic_message &other)
 Swap two message objects. More...
 
 boost::locale::basic_message< CharType >::operator string_type () const
 Message class can be explicitly converted to string class. More...
 
string_type boost::locale::basic_message< CharType >::str () const
 Translate message to a string in the default global locale, using default domain. More...
 
string_type boost::locale::basic_message< CharType >::str (std::locale const &locale) const
 Translate message to a string in the locale locale, using default domain. More...
 
string_type boost::locale::basic_message< CharType >::str (std::locale const &locale, std::string const &domain_id) const
 Translate message to a string using locale locale and message domain domain_id. More...
 
string_type boost::locale::basic_message< CharType >::str (std::string const &domain_id) const
 Translate message to a string using the default locale and message domain domain_id. More...
 
string_type boost::locale::basic_message< CharType >::str (std::locale const &loc, int id) const
 Translate message to a string using locale loc and message domain index id. More...
 
void boost::locale::basic_message< CharType >::write (std::basic_ostream< char_type > &out) const
 Translate message and write to stream out, using imbued locale and domain set to the stream. More...
 
template<typename CharType >
std::basic_ostream< CharType > & boost::locale::operator<< (std::basic_ostream< CharType > &out, basic_message< CharType > const &msg)
 Translate message msg and write it to stream. More...
 

Indirect message translation function family

template<typename CharType >
basic_message< CharType > boost::locale::translate (CharType const *msg)
 Translate a message, msg is not copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (CharType const *context, CharType const *msg)
 Translate a message in context, msg and context are not copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (CharType const *single, CharType const *plural, int n)
 Translate a plural message form, single and plural are not copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (CharType const *context, CharType const *single, CharType const *plural, int n)
 Translate a plural message from in constext, context, single and plural are not copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (std::basic_string< CharType > const &msg)
 Translate a message, msg is copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (std::basic_string< CharType > const &context, std::basic_string< CharType > const &msg)
 Translate a message in context,context and msg is copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (std::basic_string< CharType > const &context, std::basic_string< CharType > const &single, std::basic_string< CharType > const &plural, int n)
 Translate a plural message form in constext, context, single and plural are copied. More...
 
template<typename CharType >
basic_message< CharType > boost::locale::translate (std::basic_string< CharType > const &single, std::basic_string< CharType > const &plural, int n)
 Translate a plural message form, single and plural are copied. More...
 

Direct message translation functions family

template<typename CharType >
std::basic_string< CharType > boost::locale::gettext (CharType const *id, std::locale const &loc=std::locale())
 Translate message id according to locale loc. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::ngettext (CharType const *s, CharType const *p, int n, std::locale const &loc=std::locale())
 Translate plural form according to locale loc. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::dgettext (char const *domain, CharType const *id, std::locale const &loc=std::locale())
 Translate message id according to locale loc in domain domain. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::dngettext (char const *domain, CharType const *s, CharType const *p, int n, std::locale const &loc=std::locale())
 Translate plural form according to locale loc in domain domain. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::pgettext (CharType const *context, CharType const *id, std::locale const &loc=std::locale())
 Translate message id according to locale loc in context context. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::npgettext (CharType const *context, CharType const *s, CharType const *p, int n, std::locale const &loc=std::locale())
 Translate plural form according to locale loc in context context. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::dpgettext (char const *domain, CharType const *context, CharType const *id, std::locale const &loc=std::locale())
 Translate message id according to locale loc in domain domain in context context. More...
 
template<typename CharType >
std::basic_string< CharType > boost::locale::dnpgettext (char const *domain, CharType const *context, CharType const *s, CharType const *p, int n, std::locale const &loc=std::locale())
 Translate plural form according to locale loc in domain domain in context context. More...
 

Detailed Description

This module provides message translation functionality, i.e.

allow your application to speak native language

Typedef Documentation

template<typename CharType>
typedef CharType boost::locale::message_format< CharType >::char_type

Character type.

template<typename CharType>
typedef CharType boost::locale::basic_message< CharType >::char_type

The character this message object is used with.

template<typename CharType>
typedef message_format<char_type> boost::locale::basic_message< CharType >::facet_type

The type of the facet the messages are fetched with.

typedef basic_message<char> boost::locale::message

#include <boost_1_57_0/boost/locale/message.hpp>

Convenience typedef for char.

template<typename CharType>
typedef std::basic_string<CharType> boost::locale::message_format< CharType >::string_type

String type.

template<typename CharType>
typedef std::basic_string<char_type> boost::locale::basic_message< CharType >::string_type

The string type this object can be used with.

typedef basic_message<wchar_t> boost::locale::wmessage

#include <boost_1_57_0/boost/locale/message.hpp>

Convenience typedef for wchar_t.

Function Documentation

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( )
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Create default empty message.

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( char_type const *  id)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple message from 0 terminated string.

The string should exist until the message is destroyed. Generally useful with static constant strings

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( char_type const *  single,
char_type const *  plural,
int  n 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple plural form message from 0 terminated strings.

The strings should exist until the message is destroyed. Generally useful with static constant strings.

n is the number, single and plural are singular and plural forms of the message

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( char_type const *  context,
char_type const *  id 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple message from 0 terminated strings, with context information.

The string should exist until the message is destroyed. Generally useful with static constant strings

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( char_type const *  context,
char_type const *  single,
char_type const *  plural,
int  n 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple plural form message from 0 terminated strings, with context.

The strings should exist until the message is destroyed. Generally useful with static constant strings.

n is the number, single and plural are singular and plural forms of the message

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( string_type const &  id)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple message from a string.

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( string_type const &  single,
string_type const &  plural,
int  number 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple plural form message from strings.

n is the number, single and plural are single and plural forms of the message

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( string_type const &  context,
string_type const &  id 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple message from a string with context.

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( string_type const &  context,
string_type const &  single,
string_type const &  plural,
int  number 
)
inlineexplicit

#include <boost_1_57_0/boost/locale/message.hpp>

Create a simple plural form message from strings.

n is the number, single and plural are single and plural forms of the message

template<typename CharType>
boost::locale::basic_message< CharType >::basic_message ( basic_message< CharType > const &  other)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Copy an object.

template<typename CharType>
boost::locale::message_format< CharType >::message_format ( size_t  refs = 0)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Default constructor.

template<typename CharType>
virtual boost::locale::message_format< CharType >::~message_format ( )
inlineprotectedvirtual
template<typename CharType>
virtual char_type const* boost::locale::message_format< CharType >::convert ( char_type const *  msg,
string_type buffer 
) const
pure virtual

#include <boost_1_57_0/boost/locale/message.hpp>

Convert the string msg to target locale's encoding.

If msg is already in target encoding it would be returned otherwise the converted string is stored in temporary buffer and buffer.c_str() is returned.

Note: for char_type that is char16_t, char32_t and wchar_t it is no-op, returns msg

template<typename CharType >
std::basic_string<CharType> boost::locale::dgettext ( char const *  domain,
CharType const *  id,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message id according to locale loc in domain domain.

References boost::str().

template<typename CharType >
std::basic_string<CharType> boost::locale::dngettext ( char const *  domain,
CharType const *  s,
CharType const *  p,
int  n,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate plural form according to locale loc in domain domain.

References boost::n, boost::multiprecision::backends::p, boost::asio::s, and boost::str().

template<typename CharType >
std::basic_string<CharType> boost::locale::dnpgettext ( char const *  domain,
CharType const *  context,
CharType const *  s,
CharType const *  p,
int  n,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate plural form according to locale loc in domain domain in context context.

References boost::phoenix::context(), boost::n, boost::multiprecision::backends::p, boost::asio::s, and boost::str().

template<typename CharType>
virtual int boost::locale::message_format< CharType >::domain ( std::string const &  domain) const
pure virtual

#include <boost_1_57_0/boost/locale/message.hpp>

Convert a string that defines domain to the integer id used by get functions.

template<typename CharType >
std::basic_string<CharType> boost::locale::dpgettext ( char const *  domain,
CharType const *  context,
CharType const *  id,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message id according to locale loc in domain domain in context context.

References boost::phoenix::context(), and boost::str().

template<typename CharType>
virtual char_type const* boost::locale::message_format< CharType >::get ( int  domain_id,
char_type const *  context,
char_type const *  id 
) const
pure virtual

#include <boost_1_57_0/boost/locale/message.hpp>

This function returns a pointer to the string for a message defined by a context and identification string id.

Both create a single key for message lookup in a domain defined by domain_id.

If context is NULL it is not considered to be a part of the key

If a translated string is found, it is returned, otherwise NULL is returned

template<typename CharType>
virtual char_type const* boost::locale::message_format< CharType >::get ( int  domain_id,
char_type const *  context,
char_type const *  single_id,
int  n 
) const
pure virtual

#include <boost_1_57_0/boost/locale/message.hpp>

This function returns a pointer to the string for a plural message defined by a context and identification string single_id.

If context is NULL it is not considered to be a part of the key

Both create a single key for message lookup in a domain defined domain_id. n is used to pick the correct translation string for a specific number.

If a translated string is found, it is returned, otherwise NULL is returned

template<typename CharType >
std::basic_string<CharType> boost::locale::gettext ( CharType const *  id,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message id according to locale loc.

References boost::str().

template<typename CharType >
std::basic_string<CharType> boost::locale::ngettext ( CharType const *  s,
CharType const *  p,
int  n,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate plural form according to locale loc.

References boost::n, boost::multiprecision::backends::p, boost::asio::s, and boost::str().

template<typename CharType >
std::basic_string<CharType> boost::locale::npgettext ( CharType const *  context,
CharType const *  s,
CharType const *  p,
int  n,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate plural form according to locale loc in context context.

References boost::phoenix::context(), boost::n, boost::multiprecision::backends::p, boost::asio::s, and boost::str().

template<typename CharType>
boost::locale::basic_message< CharType >::operator string_type ( ) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Message class can be explicitly converted to string class.

template<typename CharType >
std::basic_ostream<CharType>& boost::locale::operator<< ( std::basic_ostream< CharType > &  out,
basic_message< CharType > const &  msg 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message msg and write it to stream.

References boost::out, and boost::locale::basic_message< CharType >::write().

template<typename CharType>
basic_message const& boost::locale::basic_message< CharType >::operator= ( basic_message< CharType > const &  other)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Assign other message object to this one.

template<typename CharType >
std::basic_string<CharType> boost::locale::pgettext ( CharType const *  context,
CharType const *  id,
std::locale const &  loc = std::locale() 
)

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message id according to locale loc in context context.

References boost::phoenix::context(), and boost::str().

template<typename CharType>
string_type boost::locale::basic_message< CharType >::str ( ) const
inline
template<typename CharType>
string_type boost::locale::basic_message< CharType >::str ( std::locale const &  locale) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message to a string in the locale locale, using default domain.

template<typename CharType>
string_type boost::locale::basic_message< CharType >::str ( std::locale const &  locale,
std::string const &  domain_id 
) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message to a string using locale locale and message domain domain_id.

template<typename CharType>
string_type boost::locale::basic_message< CharType >::str ( std::string const &  domain_id) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message to a string using the default locale and message domain domain_id.

template<typename CharType>
string_type boost::locale::basic_message< CharType >::str ( std::locale const &  loc,
int  id 
) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message to a string using locale loc and message domain index id.

template<typename CharType>
void boost::locale::basic_message< CharType >::swap ( basic_message< CharType > &  other)
inline
template<typename CharType >
basic_message<CharType> boost::locale::translate ( CharType const *  msg)
inline
template<typename CharType >
basic_message<CharType> boost::locale::translate ( CharType const *  context,
CharType const *  msg 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a message in context, msg and context are not copied.

References boost::phoenix::context().

template<typename CharType >
basic_message<CharType> boost::locale::translate ( CharType const *  single,
CharType const *  plural,
int  n 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a plural message form, single and plural are not copied.

References boost::n, and boost::mpi::threading::single.

template<typename CharType >
basic_message<CharType> boost::locale::translate ( CharType const *  context,
CharType const *  single,
CharType const *  plural,
int  n 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a plural message from in constext, context, single and plural are not copied.

References boost::phoenix::context(), boost::n, and boost::mpi::threading::single.

template<typename CharType >
basic_message<CharType> boost::locale::translate ( std::basic_string< CharType > const &  msg)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a message, msg is copied.

template<typename CharType >
basic_message<CharType> boost::locale::translate ( std::basic_string< CharType > const &  context,
std::basic_string< CharType > const &  msg 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a message in context,context and msg is copied.

References boost::phoenix::context().

template<typename CharType >
basic_message<CharType> boost::locale::translate ( std::basic_string< CharType > const &  context,
std::basic_string< CharType > const &  single,
std::basic_string< CharType > const &  plural,
int  n 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a plural message form in constext, context, single and plural are copied.

References boost::phoenix::context(), boost::n, and boost::mpi::threading::single.

template<typename CharType >
basic_message<CharType> boost::locale::translate ( std::basic_string< CharType > const &  single,
std::basic_string< CharType > const &  plural,
int  n 
)
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate a plural message form, single and plural are copied.

References boost::n, and boost::mpi::threading::single.

template<typename CharType>
void boost::locale::basic_message< CharType >::write ( std::basic_ostream< char_type > &  out) const
inline

#include <boost_1_57_0/boost/locale/message.hpp>

Translate message and write to stream out, using imbued locale and domain set to the stream.

Referenced by boost::locale::operator<<(), boost::locale::basic_message< char_type >::str(), and boost::locale::basic_message< char_type >::write().