ImageEn, unit ievision

LanguageExistsInFolder


Declaration

function LanguageExistsInFolder(Language: TIEOCRLanguages; const Folder: string = '') : Boolean; overload;
function LanguageExistsInFolder(const LanguageCode: string; const Folder: string = '') : Boolean; overload;


Description

Returns true if the language file for the specified language is found in a folder.
If folder is '', the windows current folder is checked.
Language files of IEVision will be named with a language code followed by the extension .TrainedData (IEV_OCR_Language_Data_Ext), e.g. eng.TrainedData or fra.TrainedData.

Note: For OSD options the file "osd.traineddata" is required. You can check for this using LanguageExistsInFolder( 'osd' );


Examples

if LanguageExistsInFolder(IEVisionLanguageNameToCode('English'), ExtractFilePath(Application.ExeName)) = False then
  MessageDlg('The English language OCR files could not be found. Please reinstall.', mtError, [mbOK], 0);

if LanguageExistsInFolder(OCR_English_language, ExtractFilePath(Application.ExeName)) = False then
  MessageDlg('The English language OCR files could not be found. Please reinstall.', mtError, [mbOK], 0);

if LanguageExistsInFolder( 'osd' ) = False then
  MessageDlg('Orientation files could not be found. Please reinstall.', mtError, [mbOK], 0);


See Also

TIEOCRLanguages
IEVisionGetLanguagesInFolder
IEVisionLanguageCodeToName
IEVisionLanguageNameToCode