 |
|
 |
 |
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>
Collaboration diagram for NLMISC::CI18N:
[legend]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. More...
|
| void | load (uint32 lid) |
| | Load a language file depending of the language. 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", "fun" } |
| std::vector<ucstring> | _LanguageNames |
| bool | _LanguagesNamesLoaded = false |
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 (), "rms");
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(s):
-
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]
|
|
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]
|
|
|
|
Find a string in the selected language and return his association.
Definition at line 358 of file i18n.cpp. |
|
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.
Definition at line 386 of file i18n.cpp. |
|
void NLMISC::CI18N::load (
|
uint32 lid ) [static]
|
|
|
|
Load a language file depending of the language.
Definition at line 225 of file i18n.cpp. |
|
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 220 of file i18n.cpp. |
|
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", "fun" } [static, private]
|
|
vector< ucstring > NLMISC::CI18N::_LanguageNames [static, private]
|
|
bool NLMISC::CI18N::_LanguagesNamesLoaded = false [static, private]
|
|
string NLMISC::CI18N::_Path = "" [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:
|
 |