SourceMod::ITranslator Class Reference

Provides functions for translation. More...

#include <public/ITranslator.h>

Inherits SourceMod::SMInterface.

Inheritance diagram for SourceMod::ITranslator:

[legend]
Collaboration diagram for SourceMod::ITranslator:
[legend]
List of all members.

Public Member Functions

virtual const char * GetInterfaceName ()=0
 Must return a string defining the interface's unique name.
virtual unsigned int GetInterfaceVersion ()=0
 Must return an integer defining the interface's version.
virtual IPhraseCollectionCreatePhraseCollection ()=0
 Creates a new phrase collection object.
virtual unsigned int GetServerLanguage ()=0
 Returns the server language.
virtual unsigned int GetClientLanguage (int client)=0
 Returns a client's language.
virtual int SetGlobalTarget (int index)=0
 Sets the global client SourceMod will use for assisted translations (that is, t).
virtual int GetGlobalTarget () const=0
 Returns the global client SourceMod is currently using for assisted translations (that is, t).
virtual bool FormatString (char *buffer, size_t maxlength, const char *format, IPhraseCollection *pPhrases, void **params, unsigned int numparams, size_t *pOutLength, const char **pFailPhrase)=0
 Formats a phrase given a parameter stack. The parameter stack size must exactly match the expected parameter count. If this count is too small or too large, the format fails.

Detailed Description

Provides functions for translation.

Definition at line 226 of file ITranslator.h.


Member Function Documentation

virtual IPhraseCollection* SourceMod::ITranslator::CreatePhraseCollection (  )  [pure virtual]

Creates a new phrase collection object.

Returns:
A new phrase collection object, which must be destroyed via IPhraseCollection::Destroy() when no longer needed.

virtual unsigned int SourceMod::ITranslator::GetServerLanguage (  )  [pure virtual]

Returns the server language.

Returns:
Server language index.

virtual unsigned int SourceMod::ITranslator::GetClientLanguage ( int  client  )  [pure virtual]

Returns a client's language.

Parameters:
client Client index.
Returns:
Client language index, or server's if client's is not known.

virtual int SourceMod::ITranslator::SetGlobalTarget ( int  index  )  [pure virtual]

Sets the global client SourceMod will use for assisted translations (that is, t).

Parameters:
index Client index (0 for server).
Returns:
Old global client value.

virtual int SourceMod::ITranslator::GetGlobalTarget (  )  const [pure virtual]

Returns the global client SourceMod is currently using for assisted translations (that is, t).

Returns:
Global client index (0 for server).

virtual bool SourceMod::ITranslator::FormatString ( char *  buffer,
size_t  maxlength,
const char *  format,
IPhraseCollection pPhrases,
void **  params,
unsigned int  numparams,
size_t *  pOutLength,
const char **  pFailPhrase 
) [pure virtual]

Formats a phrase given a parameter stack. The parameter stack size must exactly match the expected parameter count. If this count is too small or too large, the format fails.

Note: This is the same as IPhraseCollection::FormatString(), except that the IPhraseCollection parameter is explicit instead of implicit.

Parameters:
buffer Buffer to store formatted text.
maxlength Maximum length of the buffer.
format String containing format information. This is equivalent to SourceMod's Format() native, and sub-translations are acceptable.
pPhrases Optional phrase collection pointer to search for phrases.
params An array of pointers to each parameter. Integer parameters must have a pointer to the integer. Float parameters must have a pointer to a float. String parameters must be a string pointer. Char parameters must be a pointer to a char. Translation parameters fill multiple indexes in the array. For T translations, the expected stack is: [phrase string pointer] [int target id pointer] [...] Where [...] is the required parameters for the translation, in the order expected by the phrase, not the phrase's translation. For example, say the format is: "%d %T" and the phrase's format is {1:s,2:f}, then the parameter stack should be: int *, const char *, int *, const char *, float * The t modifier is the same except the target id pointer would be removed: int *, const char *, const char *, float *
numparams Number of parameters in the params array.
pOutLength Optional pointer filled with output length on success.
pFailPhrase Optional pointer; on failure, is filled with NULL if the failure was not due to a failed translation phrase. Otherwise, it is filled with the given phrase name pointer from the parameter stack. Undefined on success.
Returns:
True on success. False if the parameter stack was not exactly the right length, or if a translation phrase could not be found.


The documentation for this class was generated from the following file:
Generated on Fri Nov 21 04:10:06 2008 for SourceMod SDK by  doxygen 1.5.1