Exposed GetLanguageInfo in ITranslator interface (bug 5249, r=asherkin).

This commit is contained in:
Ryan Stecker 2012-05-28 00:58:59 +01:00
parent 0d5ef132f3
commit 70994cb4b2
2 changed files with 12 additions and 2 deletions

View File

@ -119,7 +119,6 @@ public:
unsigned int FindOrAddPhraseFile(const char *phrase_file); unsigned int FindOrAddPhraseFile(const char *phrase_file);
BaseStringTable *GetStringTable(); BaseStringTable *GetStringTable();
unsigned int GetLanguageCount(); unsigned int GetLanguageCount();
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
bool GetLanguageByCode(const char *code, unsigned int *index); bool GetLanguageByCode(const char *code, unsigned int *index);
bool GetLanguageByName(const char *name, unsigned int *index); bool GetLanguageByName(const char *name, unsigned int *index);
CPhraseFile *GetFileByIndex(unsigned int index); CPhraseFile *GetFileByIndex(unsigned int index);
@ -146,6 +145,7 @@ public: //ITranslator
unsigned int numparams, unsigned int numparams,
size_t *pOutLength, size_t *pOutLength,
const char **pFailPhrase); const char **pFailPhrase);
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
private: private:
bool AddLanguage(const char *langcode, const char *description); bool AddLanguage(const char *langcode, const char *description);
private: private:

View File

@ -35,7 +35,7 @@
#include <IShareSys.h> #include <IShareSys.h>
#define SMINTERFACE_TRANSLATOR_NAME "ITranslator" #define SMINTERFACE_TRANSLATOR_NAME "ITranslator"
#define SMINTERFACE_TRANSLATOR_VERSION 2 #define SMINTERFACE_TRANSLATOR_VERSION 3
#define MAX_TRANSLATE_PARAMS 32 #define MAX_TRANSLATE_PARAMS 32
#define CORELANG_ENGLISH 0 #define CORELANG_ENGLISH 0
@ -341,6 +341,16 @@ namespace SourceMod
* @return True if found, false otherwise. * @return True if found, false otherwise.
*/ */
virtual bool GetLanguageByName(const char *name, unsigned int *index) =0; virtual bool GetLanguageByName(const char *name, unsigned int *index) =0;
/**
* @brief Retrieves info about a given language number.
*
* @param number Language number.
* @param code Pointer to store the language code.
* @param name Pointer to store language name.
* @return True if language number is valid, false otherwise.
*/
virtual bool GetLanguageInfo(unsigned int number, const char **code, const char **name) =0;
}; };
} }