ImageEn, unit ievision

IEVisionLanguageNameToCode


Declaration

function IEVisionLanguageNameToCode(const LanguageName: string): string; overload;
function IEVisionLanguageNameToCode(const Language: TIEOCRLanguages): string; overload;


Description

Returns the language code (which can be used for loading an OCR language file) from a display name (filled using TIEOCRLanguages).

E.g. IEVisionLanguageNameToCode('English') would retun 'eng'.


Example

procedure TMainForm.FormCreate(Sender: TObject);
begin
  // Fill our Combobox with available languages
  IEVisionGetLanguagesInFolder(cmbLanguage.Items, ExtractFilePath(Application.ExeName), True);

  // Default to English
  cmbLanguage.ItemIndex := cmbLanguage.Items.IndexOf(IEOCRLanguageList[OCR_English_language].DisplayName);
end;

procedure TMainForm.btnRecognizeClick(Sender: TObject);
var
  sLangCode: string;
begin
  // Get selected language code
  sLangCode := IEVisionLanguageNameToCode(cmbLanguage.Text);

  // create OCR object
  m_OCR := IEVisionLib.createOCR( PAnsiChar(ExtractFilePath( Application.ExeName )), PAnsiChar( sLangCode ));
  ...
end;


See Also

TIEOCRLanguages
IEVisionLanguageCodeToName
IEVisionGetLanguagesInFolder