Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreLocalizer.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_LOCALIZER__
8 #define __HDI_CORE_LOCALIZER__
9 
10 #include <map>
11 
12 #include "hdicoreTypes.h"
13 
17 #define HDI_CORE_LOCALIZER hdi::core::Localizer::instance()
18 
19 namespace hdi
20 {
21  namespace core
22  {
47  class Localizer
48  {
49  public:
50  typedef std::map<Locale, std::string> StringMap;
51 
59  static Localizer* instance();
60 
68  Locale defaultLocale() const;
69 
77  void setDefaultLocale(const Locale defaultLocale_);
78 
88  void addString(const std::string& key_, const Locale locale_, const std::string& str_);
89 
98  void removeString(const std::string& key_, const Locale locale_);
99 
109  StringMap getAllStrings(const std::string& key_) const;
110 
122  std::string getString(const std::string& key_, const Locale locale_) const;
123 
136  std::string getLocalString(const std::string& key_) const;
137 
138 
139  private:
140  friend class Plugin;
141 
145  static Localizer* __instance;
146 
152  Localizer();
153 
159  ~Localizer();
160  };
161  }
162 }
163 
164 #endif
165 // __HDI_CORE_LOCALIZER__
std::string getLocalString(const std::string &key_) const
Gets a localized string for a given key and whatever locale Illustrator currently has...
void setDefaultLocale(const Locale defaultLocale_)
Sets the default locale of the Localizer instance.
std::string getString(const std::string &key_, const Locale locale_) const
Gets a localized string for a given key and locale.
Base plugin class; the heart of any plugin project.
Definition: hdicorePlugin.h:40
Locale defaultLocale() const
Gets the default locale of the Localizer instance.
StringMap getAllStrings(const std::string &key_) const
Gets a map of locales and their corresponding localized strings for a given key.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
static Localizer * instance()
Allows access to the singleton localizer instance object.
Definition: hdicoreaiArray.h:12
Singleton class to aid in runtime localization.
Definition: hdicoreLocalizer.h:47
void removeString(const std::string &key_, const Locale locale_)
Removes an existing localized string value by its key and locale.
void addString(const std::string &key_, const Locale locale_, const std::string &str_)
Adds a new localized string value, keyed by a unique string and the value's locale.