MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / setLanguageFromName

Method setLanguageFromName

other_src/astyle/src/ASLocalizer.cpp:178–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void ASLocalizer::setLanguageFromName(const char* langID)
179// Linux set the language to use from the langID.
180//
181// the language string has the following form
182//
183// lang[_LANG][.encoding][@modifier]
184//
185// (see environ(5) in the Open Unix specification)
186//
187// where lang is the primary language, LANG is a sublang/territory,
188// encoding is the charset to use and modifier "allows the user to select
189// a specific instance of localization data within a single category"
190//
191// for example, the following strings are valid:
192// fr
193// fr_FR
194// de_DE.iso88591
195// de_DE@euro
196// de_DE.iso88591@euro
197{
198 // the constants describing the format of lang_LANG locale string
199 static const size_t LEN_LANG = 2;
200 static const size_t LEN_SUBLANG = 2;
201
202 m_lcid = 0;
203 string langStr = langID;
204 m_langID = langStr.substr(0, LEN_LANG);
205
206 // need the sublang for chinese
207 if (m_langID == "zh" && langStr[LEN_LANG] == '_')
208 {
209 string subLang = langStr.substr(LEN_LANG + 1, LEN_SUBLANG);
210 if (subLang == "CN" || subLang == "SG")
211 m_subLangID = "CHS";
212 else
213 m_subLangID = "CHT"; // default
214 }
215 setTranslationClass();
216}
217
218const char* ASLocalizer::settext(const char* textIn) const
219// Call the settext class and return the value.

Callers 1

processOptionsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected