How to get an ID of language

int sol_FindLanguage( HGREN hEngine, const wchar_t * LanguageName )

int sol_FindLanguage8( HGREN hEngine, const char * LanguageNameUtf8 )


hEngine - grammatical dictionary instance handle.

LanguageName - language name. The search is case insensitive.

Return value:

-1 - there is no language with a given name.

value>=0 - the primary key (id) of the language.


The only difference between sol_FindLanguag and sol_FindLanguage8 is the language name encoding. sol_FindLanguage8 accepts the name in utf-8.

There are symbolic constants for the IDs of almost all languages. They are declared in _sg_api.* files for C, C++, C# and Delphi.

The language names are specified during grammatical dictionary assembly and can be in any language. The current version of SDK uses only English names.

Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.

The functions are thread-safe.

C++ sample:

#include "solarix_grammar_engine.h"


HGREN hEngine = sol_CreateGrammarEngineW(L"..\\..\\bin-windows\\dictionary.xml");


int RusLangID = sol_FindLanguage( hEngine, L"Russian" );

// ...

C# sample:

IntPtr gren = SolarixGrammarEngineNET.GrammarEngine.sol_CreateGrammarEngineW("..\\..\\bin-windows\\dictionary.xml");

// ...

int LanguageID = SolarixGrammarEngineNET.GrammarEngine.sol_FindLanguage( gren, "Chinese" );

Related topics

Purchase the Grammatical Dictionary SDK

Russian version of this page

Language declaration in grammatical dictionary

Language class in ORM library

API layer C++ source code: grammar_engine_api.cpp

Back to the list of API calls

  © Mental Computing 2009  home  rss  email  icq  download
changed 04-Apr-11