ImageEn, unit ievision

IEVisionLanguageNameToCode

IEVisionLanguageNameToCode


Declaration


function IEVisionLanguageNameToCode(const sLangName : string) : string;


Description


Returns the language code (which can be used for loading an OCR language file) from a display name (filled using A 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), ievOCRFAST);
  ...
end;


See Also


- TIEOCRLanguages
- IEVisionLanguageCodeToName
- IEVisionGetLanguagesInFolder