libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
translator.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 #ifndef _QI_TRANSLATOR_HPP_
8 #define _QI_TRANSLATOR_HPP_
9 
10 # include <boost/noncopyable.hpp>
11 # include <string>
12 # include <qi/api.hpp>
13 
14 
15 namespace qi
16 {
17  class TranslatorPrivate;
24  class QI_API Translator : private boost::noncopyable
25  {
26  public:
31  Translator(const std::string &name);
32  ~Translator();
33 
43  std::string translate(const std::string &msg,
44  const std::string &domain = "",
45  const std::string &locale = "",
46  const std::string &context = "");
47 
55  std::string translateContext(const std::string &msg,
56  const std::string &context);
57 
63  void setCurrentLocale(const std::string &locale);
69  void setDefaultDomain(const std::string &domain);
75  void addDomain(const std::string &domain);
76 
77  private:
78  TranslatorPrivate *_p;
79  };
80 
87  QI_API qi::Translator &defaultTranslator(const std::string &name);
88 
92  QI_API std::string tr(const std::string &msg,
93  const std::string &domain = "",
94  const std::string &locale = "",
95  const std::string &context = "");
96 
100  QI_API std::string trContext(const std::string &msg,
101  const std::string &context);
102  namespace detail
103  {
104  QI_API void addDomainPath(const std::string &path);
105  QI_API void removeDomainPath(const std::string &path);
106  }
107 
108 }
109 
110 #endif // _QI_TRANSLATOR_HPP_
#define QI_API
Definition: api.hpp:33
void addDomainPath(const std::string &path)
Localization of your source code.
Definition: translator.hpp:24
qi::Translator & defaultTranslator(const std::string &name)
Get a reference on the default Translator.
dll import/export and compiler message
std::string tr(const std::string &msg, const std::string &domain="", const std::string &locale="", const std::string &context="")
Translate a message.
void removeDomainPath(const std::string &path)
std::string trContext(const std::string &msg, const std::string &context)
Translate a message with a specific context.
int context()
Get log context.