#include <localemgr.h>
Collaboration diagram for LocaleMgr:
Public Methods | |
LocaleMgr (const char *iConfigPath=0) | |
Default constructor of LocaleMgr You do normally not need this constructor, use LocaleMgr::systemLocaleMgr instead. | |
virtual | ~LocaleMgr () |
Default destructor of LocaleMgr. | |
virtual SWLocale * | getLocale (const char *name) |
Get the locale connected with the name "name". More... | |
virtual list< string > | getAvailableLocales () |
Get the list of available locales. More... | |
virtual const char * | translate (const char *text, const char *localeName=0) |
Returns translated text. More... | |
virtual const char * | getDefaultLocaleName () |
Get the default locale name. More... | |
virtual void | setDefaultLocaleName (const char *name) |
Set the new standard locale of Sword. More... | |
virtual void | loadConfigDir (const char *ipath) |
Augment this localmgr with all locale.conf files in a directory. | |
Static Public Attributes | |
LocaleMgr | systemLocaleMgr |
The LocaleMgr object used globally in the Sword world. More... | |
Protected Attributes | |
LocaleMap | locales |
Private Methods | |
void | deleteLocales () |
Private Attributes | |
char * | defaultLocaleName |
It provides functions to get a list of all available locales, to get the default locale name and to get it. The other functions are not interesting for frontend programmers.
To get the default locale name use
Definition at line 49 of file localemgr.h.
|
Get the list of available locales. @ret Returns a list of strings, which contains the names of the available locales. Definition at line 156 of file localemgr.cpp.
00156 { 00157 list <string> retVal; 00158 for (LocaleMap::iterator it = locales.begin(); it != locales.end(); it++) 00159 retVal.push_back((*it).second->getName()); 00160 00161 return retVal; 00162 } |
|
Get the default locale name. To set it use
Definition at line 177 of file localemgr.cpp. Referenced by translate().
00177 { 00178 return defaultLocaleName; 00179 } |
|
Get the locale connected with the name "name".
Definition at line 145 of file localemgr.cpp. Referenced by translate().
00145 { 00146 LocaleMap::iterator it; 00147 00148 it = locales.find(name); 00149 if (it != locales.end()) 00150 return (*it).second; 00151 00152 return 0; 00153 } |
|
Set the new standard locale of Sword.
Definition at line 182 of file localemgr.cpp. Referenced by LocaleMgr().
00182 { 00183 stdstr(&defaultLocaleName, name); 00184 } |
|
Returns translated text. This function uses both parameters to return the translated version of the given text.
Definition at line 165 of file localemgr.cpp. References getDefaultLocaleName(), getLocale(), and SWLocale::translate().
00165 { 00166 SWLocale *target; 00167 if (!localeName) { 00168 localeName = getDefaultLocaleName(); 00169 } 00170 target = getLocale(localeName); 00171 if (target) 00172 return target->translate(text); 00173 return text; 00174 } |
|
The LocaleMgr object used globally in the Sword world. Do not create your own LocaleMgr, use this static object instead. Definition at line 43 of file localemgr.cpp. Referenced by VerseKey::init(). |