2 // Copyright (c) 2017 by Jim Pattee <jimp03@email.com>.
3 // This code is licensed under the MIT License.
4 // License.md describes the conditions under which this software may be distributed.
19 //-----------------------------------------------------------------------------
20 // ASLocalizer class for console build.
21 // This class encapsulates all language-dependent settings and is a
22 // generalization of the C locale concept.
23 //-----------------------------------------------------------------------------
30 virtual ~ASLocalizer();
31 string getLanguageID() const;
32 const Translation* getTranslationClass() const;
34 void setLanguageFromLCID(size_t lcid);
36 void setLanguageFromName(const char* langID);
37 const char* settext(const char* textIn) const;
40 void setTranslationClass();
43 Translation* m_translation; // pointer to a polymorphic Translation class
44 string m_langID; // language identifier from the locale
45 string m_subLangID; // sub language identifier, if needed
46 string m_localeName; // name of the current locale (Linux only)
47 size_t m_lcid; // LCID of the user locale (Windows only)
50 //----------------------------------------------------------------------------
51 // Translation base class.
52 //----------------------------------------------------------------------------
55 // This base class is inherited by the language translation classes.
56 // Polymorphism is used to call the correct language translator.
57 // This class contains the translation vector and settext translation method.
58 // The language vector is built by the language sub classes.
59 // NOTE: This class must have virtual methods for typeid() to work.
60 // typeid() is used by AStyleTestI18n_Localizer.cpp.
64 virtual ~Translation() {}
65 string convertToMultiByte(const wstring& wideStr) const;
66 size_t getTranslationVectorSize() const;
67 bool getWideTranslation(const string& stringIn, wstring& wideOut) const;
68 string& translate(const string& stringIn) const;
71 void addPair(const string& english, const wstring& translated);
73 vector<pair<string, wstring> > m_translation; // translation vector
76 mutable string m_mbTranslation;
79 //----------------------------------------------------------------------------
80 // Translation classes
81 // One class for each language.
82 // These classes have only a constructor which builds the language vector.
83 //----------------------------------------------------------------------------
85 class Bulgarian : public Translation
86 { public: Bulgarian(); };
88 class ChineseSimplified : public Translation
89 { public: ChineseSimplified(); };
91 class ChineseTraditional : public Translation
92 { public: ChineseTraditional(); };
94 class Dutch : public Translation
97 class English : public Translation
98 { public: English(); };
100 class Estonian : public Translation
101 { public: Estonian(); };
103 class Finnish : public Translation
104 { public: Finnish(); };
106 class French : public Translation
107 { public: French(); };
109 class German : public Translation
110 { public: German(); };
112 class Greek : public Translation
113 { public: Greek(); };
115 class Hindi : public Translation
116 { public: Hindi(); };
118 class Hungarian : public Translation
119 { public: Hungarian(); };
121 class Italian : public Translation
122 { public: Italian(); };
124 class Japanese : public Translation
125 { public: Japanese(); };
127 class Korean : public Translation
128 { public: Korean(); };
130 class Norwegian : public Translation
131 { public: Norwegian(); };
133 class Polish : public Translation
134 { public: Polish(); };
136 class Portuguese : public Translation
137 { public: Portuguese(); };
139 class Romanian : public Translation
140 { public: Romanian(); };
142 class Russian : public Translation
143 { public: Russian(); };
145 class Spanish : public Translation
146 { public: Spanish(); };
148 class Swedish : public Translation
149 { public: Swedish(); };
151 class Ukrainian : public Translation
152 { public: Ukrainian(); };
157 } // namespace astyle
159 #endif // ASLOCALIZER_H