|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CI18N Class ReferenceClass for the internationalisation.
More...
#include <i18n.h>
List of all members.
Static Public Methods |
const std::vector< ucstring > & | getLanguageNames () |
| Return a vector with all language available. The vector contains the name of the language. The index in the vector is used in load() function -
Warning:
-
you *must* call this function before calling load().
More...
|
void | load (uint32 lid) |
| Load a language file depending of the language. More...
|
std::string | getCurrentLanguage () |
| Returns the name of the language in english (french, english...). More...
|
const ucstring & | get (const char *str) |
| Find a string in the selected language and return his association. More...
|
void | setPath (const char *str) |
| Temporary, we don't have file system for now, so we do a tricky cheat. there s not check so be careful! More...
|
Private Types |
typedef std::map< std::string,
ucstring >::iterator | ItStrMap |
typedef std::map< std::string,
ucstring >::value_type | ValueStrMap |
Static Private Methods |
ucchar | eatChar (IStream &is) |
void | checkASCII7B (ucchar c) |
void | createLanguageFile (uint32 lid) |
void | createLanguageEntry (const std::string &lval, const std::string &rval) |
void | skipComment (IStream &is, int &line) |
ucchar | skipWS (IStream &is, int &line) |
Static Private Attributes |
std::map< std::string, ucstring > | _StrMap |
bool | _StrMapLoaded = false |
std::string | _Path = "" |
std::string | _FileName = "" |
const char * | _LanguageFiles [] = { "english", "french" } |
std::vector< ucstring > | _LanguageNames |
bool | _LanguagesNamesLoaded = false |
sint32 | _SelectedLanguage = -1 |
Detailed Description
Class for the internationalisation.
It's a singleton pattern.
This class provide an easy way to localise all string. First you have to get all available language with getLanguageNames() . If you already know the number of the language (that is the index in the vector returns by getLanguagesNames()) , you can load the language file with load() . Now, you can get a localised string with his association with get() .
CI18N::getLanguageNames ();
CI18N::load (1);
nlinfo (CI18N::get("hi").c_str ());
nlinfo (CI18N::get("%s is a master").c_str (), "mrs");
*
If the string doesn't exist, it will be automatically added in all language files with a <Not Translated> mention. If the language file doesn't exist, it'll be automatically create.
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2000
Definition at line 64 of file i18n.h.
Member Typedef Documentation
typedef std::map<std::string, ucstring>::iterator NLMISC::CI18N::ItStrMap [private]
|
|
|
Definition at line 87 of file i18n.h.
Referenced by get. |
typedef std::map<std::string, ucstring>::value_type NLMISC::CI18N::ValueStrMap [private]
|
|
Member Function Documentation
void NLMISC::CI18N::checkASCII7B |
( |
ucchar |
c |
) |
[static, private] |
|
void NLMISC::CI18N::createLanguageEntry |
( |
const std::string & |
lval, |
|
|
const std::string & |
rval |
|
) |
[static, private] |
|
void NLMISC::CI18N::createLanguageFile |
( |
uint32 |
lid |
) |
[static, private] |
|
const ucstring & NLMISC::CI18N::get |
( |
const char * |
str |
) |
[static] |
|
string NLMISC::CI18N::getCurrentLanguage |
( |
|
) |
[static] |
|
const vector< ucstring > & NLMISC::CI18N::getLanguageNames |
( |
|
) |
[static] |
|
|
Return a vector with all language available. The vector contains the name of the language. The index in the vector is used in load() function -
Warning:
-
you *must* call this function before calling load().
Definition at line 399 of file i18n.cpp.
References _LanguageFiles, _LanguageNames, _LanguagesNamesLoaded, _Path, createLanguageFile, eatChar, nldebug, nlerror, nlwarning, skipWS, and ucchar. |
void NLMISC::CI18N::load |
( |
uint32 |
lid |
) |
[static] |
|
|
Load a language file depending of the language.
Definition at line 226 of file i18n.cpp.
References _FileName, _LanguageFiles, _LanguageNames, _LanguagesNamesLoaded, _Path, _SelectedLanguage, _StrMap, _StrMapLoaded, checkASCII7B, createLanguageFile, eatChar, nlassert, nldebug, nlerror, nlwarning, skipWS, ucchar, and ValueStrMap. |
void NLMISC::CI18N::setPath |
( |
const char * |
str |
) |
[static] |
|
|
Temporary, we don't have file system for now, so we do a tricky cheat. there s not check so be careful!
Definition at line 221 of file i18n.cpp.
References _Path. |
void NLMISC::CI18N::skipComment |
( |
IStream & |
is, |
|
|
int & |
line |
|
) |
[static, private] |
|
ucchar NLMISC::CI18N::skipWS |
( |
IStream & |
is, |
|
|
int & |
line |
|
) |
[static, private] |
|
Member Data Documentation
string NLMISC::CI18N::_FileName = "" [static, private]
|
|
const char * NLMISC::CI18N::_LanguageFiles = { "english", "french" } [static, private]
|
|
vector< ucstring > NLMISC::CI18N::_LanguageNames [static, private]
|
|
bool NLMISC::CI18N::_LanguagesNamesLoaded = false [static, private]
|
|
string NLMISC::CI18N::_Path = "" [static, private]
|
|
sint32 NLMISC::CI18N::_SelectedLanguage = -1 [static, private]
|
|
map< string, ucstring > NLMISC::CI18N::_StrMap [static, private]
|
|
bool NLMISC::CI18N::_StrMapLoaded = false [static, private]
|
|
The documentation for this class was generated from the following files:
|
|