Boost.Locale: Message Formatting (translation) Boost ,  ,  
 
 
  
   Boost.Locale
   
   
  
  
 
  
 
  boost::locale::message_format< CharType >::message_format  (size_t refs=0)  virtual char_type const *  boost::locale::message_format< CharType >::get  (int domain_id, char_type const *context, char_type const *id) const =0  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  virtual int  boost::locale::message_format< CharType >::domain  (std::string const &domain) const =0  virtual char_type const *  boost::locale::message_format< CharType >::convert  (char_type const *msg, string_type &buffer) const =0    boost::locale::basic_message< CharType >::basic_message  ()    boost::locale::basic_message< CharType >::basic_message  (char_type const *id)    boost::locale::basic_message< CharType >::basic_message  (char_type const *single, char_type const *plural, int n)    boost::locale::basic_message< CharType >::basic_message  (char_type const *context, char_type const *id)    boost::locale::basic_message< CharType >::basic_message  (char_type const *context, char_type const *single, char_type const *plural, int n)    boost::locale::basic_message< CharType >::basic_message  (string_type const &id)    boost::locale::basic_message< CharType >::basic_message  (string_type const &single, string_type const &plural, int number)    boost::locale::basic_message< CharType >::basic_message  (string_type const &context, string_type const &id)    boost::locale::basic_message< CharType >::basic_message  (string_type const &context, string_type const &single, string_type const &plural, int number)    boost::locale::basic_message< CharType >::basic_message  (basic_message const &other)  basic_message const &  boost::locale::basic_message< CharType >::operator=  (basic_message const &other)  void  boost::locale::basic_message< CharType >::swap  (basic_message &other)    boost::locale::basic_message< CharType >::operator string_type  () const   string_type  boost::locale::basic_message< CharType >::str  () const   string_type  boost::locale::basic_message< CharType >::str  (std::locale const &locale) const   string_type  boost::locale::basic_message< CharType >::str  (std::locale const &locale, std::string const &domain_id) const   string_type  boost::locale::basic_message< CharType >::str  (std::string const &domain_id) const   string_type  boost::locale::basic_message< CharType >::str  (std::locale const &loc, int id) const   void  boost::locale::basic_message< CharType >::write  (std::basic_ostream< char_type > &out) const   template<typename CharType >  std::basic_ostream< CharType > &  boost::locale::operator<<  (std::basic_ostream< CharType > &out, basic_message< CharType > const &msg)  
basic_message< CharType >  boost::locale::translate  (CharType const *msg)  Translate a message, msg  is not copied.    basic_message< CharType >  boost::locale::translate  (CharType const *context, CharType const *msg)  Translate a message in context, msg  and context  are not copied.    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.    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.    basic_message< CharType >  boost::locale::translate  (std::basic_string< CharType > const &msg)  Translate a message, msg  is copied.    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.    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.    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.    
template<typename CharType >  std::basic_string< CharType >  boost::locale::gettext  (CharType const *id, std::locale const &loc=std::locale())  template<typename CharType >  std::basic_string< CharType >  boost::locale::ngettext  (CharType const *s, CharType const *p, int n, std::locale const &loc=std::locale())  template<typename CharType >  std::basic_string< CharType >  boost::locale::dgettext  (char const *domain, CharType const *id, std::locale const &loc=std::locale())  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())  template<typename CharType >  std::basic_string< CharType >  boost::locale::pgettext  (CharType const *context, CharType const *id, std::locale const &loc=std::locale())  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())  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())  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())  
Этот модуль обеспечивает функциональность перевода сообщений, то есть позволяет вашему приложению говорить на родном языке
template<typename CharType> 
      
 
 
Удобство Typedef для char
 
 
template<typename CharType> 
      
 
 
Удобство Typedef для char16_t
 
 
Удобство Typedef для char32_t
 
 
Удобство typedef для wchar_t
 
 
template<typename CharType> 
 
Создайте по умолчанию пустое сообщение
 
 
template<typename CharType> 
 
Создайте простое сообщение из 0 завершённой строки. Строка должна существовать до тех пор, пока сообщение не будет уничтожено. Полезно для статических постоянных струн
 
 
template<typename CharType> 
 
Создайте простое сообщение множественного числа из 0 завершенных строк. Строки должны существовать до тех пор, пока сообщение не будет уничтожено. Полезно использовать статические постоянные струны.
n  - число, single  и plural  - единичные и множественные формы сообщения
 
 
template<typename CharType> 
 
Создайте простое сообщение из 0 завершенных строк с контекстной информацией. Строка должна существовать до тех пор, пока сообщение не будет уничтожено. Полезно для статических постоянных струн
 
 
template<typename CharType> 
 
Создайте простое сообщение множественного числа из 0 завершенных строк с контекстом. Строки должны существовать до тех пор, пока сообщение не будет уничтожено. Полезно использовать статические постоянные струны.
n  - число, single  и plural  - единичные и множественные формы сообщения
 
 
template<typename CharType> 
 
Создайте простое сообщение из строки.
 
 
template<typename CharType> 
 
Создайте простое сообщение множественного числа из строк.
n  - число, single  и plural  - единичные и множественные формы сообщения
 
 
template<typename CharType> 
 
Создайте простое сообщение из строки с контекстом.
 
 
template<typename CharType> 
 
Создайте простое сообщение множественного числа из строк.
n  - число, single  и plural  - единичные и множественные формы сообщения
 
 
template<typename CharType> 
 
 
template<typename CharType> 
 
Преобразуйте строку msg  в целевую кодировку локализации. Если msg  уже находится в целевом кодировании, он будет возвращен, в противном случае преобразованная строка будет сохранена во временном буфере  и будет возвращен buffer.c_str().
Примечание: для char_type, который является char16_t, char32_t и wchar_t это no-op, возвращается msg
 
 
template<typename CharType > 
      
        
          std::basic_string<CharType> boost::locale::dgettext  
          ( 
          char const *  
          domain ,  
        
          CharType const *  
          id ,  
        
          std::locale const &  
          loc  = std::locale()  
        
          ) 
           
      
 
Перевод сообщения id  в соответствии с локализацией loc  в домене domain 
 
 
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()  
        
          ) 
           
      
 
Переведите форму множественного числа в соответствии с локализацией loc  в домене domain 
 
 
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()  
        
          ) 
           
      
 
Переведите форму множественного числа в соответствии с локализацией loc  в домене domain  в контексте context 
 
 
template<typename CharType> 
 
Преобразовать строку, определяющую  домен  , в целое число id, используемое функциями get 
 
 
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()  
        
          ) 
           
      
 
Перевод сообщения id  в соответствии с локализацией loc  в домене domain  в контексте context 
 
 
template<typename CharType> 
 
Эта функция возвращает указатель в строку для сообщения, определенного контекстом  и строкой идентификации id . Оба создают один ключ для поиска сообщений в домене, определенном domain_id .
Если контекст  является NULL, он не считается частью ключа
Если найдена переведенная строка, она возвращается, в противном случае возвращается NULL
 
 
template<typename CharType> 
 
Эта функция возвращает указатель в строку для сообщения множественного числа, определенного context  и строкой идентификации single_id .
Если контекст  является NULL, он не считается частью ключа
Оба создают один ключ для поиска сообщений в домене, определенном domain_id . n  используется для выбора правильной строки перевода для определенного числа.
Если найдена переведенная строка, она возвращается, в противном случае возвращается NULL
 
 
template<typename CharType > 
      
        
          std::basic_string<CharType> boost::locale::gettext  
          ( 
          CharType const *  
          id ,  
        
          std::locale const &  
          loc  = std::locale()  
        
          ) 
           
      
 
Перевод сообщения id  в соответствии с локализацией loc 
 
 
template<typename CharType> 
 
 
template<typename CharType > 
      
        
          std::basic_string<CharType> boost::locale::ngettext  
          ( 
          CharType const *  
          s ,  
        
          CharType const *  
          p ,  
        
          int  
          n ,  
        
          std::locale const &  
          loc  = std::locale()  
        
          ) 
           
      
 
Переведите форму множественного числа в соответствии с локализацией loc 
 
 
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()  
        
          ) 
           
      
 
Переведите форму множественного числа в соответствии с локализацией loc  в контексте context 
 
 
template<typename CharType> 
 
Класс сообщений может быть явно преобразован в класс строк
 
 
template<typename CharType > 
      
        
          std::basic_ostream<CharType>& boost::locale::operator<<  
          ( 
          std::basic_ostream< CharType > &  
          out ,  
        
          basic_message< CharType > const &  
          msg   
        
          ) 
           
      
 
Переведите сообщение msg  и запишите его в поток
 
 
template<typename CharType> 
 
Назначить другое сообщение возражать против этого
 
 
template<typename CharType > 
      
        
          std::basic_string<CharType> boost::locale::pgettext  
          ( 
          CharType const *  
          context ,  
        
          CharType const *  
          id ,  
        
          std::locale const &  
          loc  = std::locale()  
        
          ) 
           
      
 
Перевод сообщения id  в соответствии с локализацией loc  в контексте context 
 
 
template<typename CharType> 
 
Перевод сообщения на строку в глобальной локализации по умолчанию с использованием домена по умолчанию
 
 
template<typename CharType> 
 
Переведите сообщение в строку в локальном локальном  , используя домен по умолчанию
 
 
template<typename CharType> 
 
Переведите сообщение в строку, используя locale locale  и домен сообщения domain_id 
 
 
template<typename CharType> 
 
Переведите сообщение в строку, используя домен domain_id 
 
 
template<typename CharType> 
 
Перевод сообщения в строку с использованием локального loc  и индекса домена сообщения id 
 
 
template<typename CharType> 
 
Своп двух объектов сообщения
 
 
template<typename CharType> 
 
Переведите сообщение и напишите для потоковой передачи out , используя настроенные на поток локальные и доменные имена
 
 
 
 
    
   
 
Статья Boost.Locale: Message Formatting (translation)  раздела  
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
:: Главная  ::