| 199 | } |
| 200 | |
| 201 | void ASLocalizer::setLanguageFromName(const char* langID) |
| 202 | // Linux set the language to use from the langID. |
| 203 | // |
| 204 | // the language string has the following form |
| 205 | // |
| 206 | // lang[_LANG][.encoding][@modifier] |
| 207 | // |
| 208 | // (see environ(5) in the Open Unix specification) |
| 209 | // |
| 210 | // where lang is the primary language, LANG is a sublang/territory, |
| 211 | // encoding is the charset to use and modifier "allows the user to select |
| 212 | // a specific instance of localization data within a single category" |
| 213 | // |
| 214 | // for example, the following strings are valid: |
| 215 | // fr |
| 216 | // fr_FR |
| 217 | // de_DE.iso88591 |
| 218 | // de_DE@euro |
| 219 | // de_DE.iso88591@euro |
| 220 | { |
| 221 | // the constants describing the format of lang_LANG locale string |
| 222 | static const size_t LEN_LANG = 2; |
| 223 | |
| 224 | m_lcid = 0; |
| 225 | string langStr = langID; |
| 226 | m_langID = langStr.substr(0, LEN_LANG); |
| 227 | |
| 228 | // need the sublang for chinese |
| 229 | if (m_langID == "zh" && langStr[LEN_LANG] == '_') |
| 230 | { |
| 231 | string subLang = langStr.substr(LEN_LANG + 1, LEN_LANG); |
| 232 | if (subLang == "CN" || subLang == "SG") |
| 233 | m_subLangID = "CHS"; |
| 234 | else |
| 235 | m_subLangID = "CHT"; // default |
| 236 | } |
| 237 | setTranslationClass(); |
| 238 | } |
| 239 | |
| 240 | const char* ASLocalizer::settext(const char* textIn) const |
| 241 | // Call the settext class and return the value. |