Provides functions for translation. More...
#include <public/ITranslator.h>
Inherits SourceMod::SMInterface.

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 IPhraseCollection * | CreatePhraseCollection ()=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. | |
| virtual unsigned int | GetLanguageCount ()=0 |
| Get number of languages. | |
| virtual bool | GetLanguageByName (const char *name, unsigned int *index)=0 |
| Find a language number by name. | |
Provides functions for translation.
Definition at line 229 of file ITranslator.h.
| virtual IPhraseCollection* SourceMod::ITranslator::CreatePhraseCollection | ( | ) | [pure virtual] |
Creates a new phrase collection object.
| virtual unsigned int SourceMod::ITranslator::GetServerLanguage | ( | ) | [pure virtual] |
Returns the server language.
| virtual unsigned int SourceMod::ITranslator::GetClientLanguage | ( | int | client | ) | [pure virtual] |
Returns a client's language.
| client | Client index. |
| virtual int SourceMod::ITranslator::SetGlobalTarget | ( | int | index | ) | [pure virtual] |
Sets the global client SourceMod will use for assisted translations (that is, t).
| index | Client index (0 for server). |
| virtual int SourceMod::ITranslator::GetGlobalTarget | ( | ) | const [pure virtual] |
Returns the global client SourceMod is currently using for assisted translations (that is, t).
| 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.
| 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. |
| virtual unsigned int SourceMod::ITranslator::GetLanguageCount | ( | ) | [pure virtual] |
Get number of languages.
| virtual bool SourceMod::ITranslator::GetLanguageByName | ( | const char * | name, | |
| unsigned int * | index | |||
| ) | [pure virtual] |
Find a language number by name.
| name | Language name. | |
| index | Optional pointer to store language index. |
1.7.1