Ignore:
Timestamp:
Aug 2, 2016, 10:06:50 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Use correct path for language files under Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolTranslator/UCoolTranslator.pas

    r43 r79  
    4646    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
    4747    function IsExcluded(Component: TPersistent; PropertyName: string): Boolean;
     48    function GetLangFileDir: string;
    4849  public
    4950    ComponentExcludes: TComponentExcludesList;
     
    161162    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
    162163    SearchMask := SearchMask + '.po';
    163     FileList := FindAllFiles(ExtractFileDir(UTF8Encode(Application.ExeName)) +
    164       DirectorySeparator + FPOFilesFolder, SearchMask);
     164    FileList := FindAllFiles(GetLangFileDir, SearchMask);
    165165    for I := 0 to FileList.Count - 1 do begin
    166166      FileName := FileList[I];
     
    180180  FPoFilesFolder := AValue;
    181181  ReloadFiles;
     182  CheckLanguageFiles;
    182183end;
    183184
     
    290291end;
    291292
     293function TCoolTranslator.GetLangFileDir: string;
     294begin
     295  Result := FPOFilesFolder;
     296  if Copy(Result, 1, 1) <> DirectorySeparator then
     297    Result := ExtractFileDir(UTF8Encode(Application.ExeName)) +
     298      DirectorySeparator + Result;
     299end;
     300
    292301procedure TCoolTranslator.LanguageListToStrings(Strings: TStrings);
    293302var
     
    349358var
    350359  I: Integer;
    351 begin
     360  LangDir: string;
     361begin
     362  LangDir := GetLangFileDir;
    352363  TLanguage(Languages[0]).Available := True; // Automatic
    353364
    354365  for I := 1 to Languages.Count - 1 do
    355366  with TLanguage(Languages[I]) do begin
    356     Available := FileExists(ExtractFileDir(UTF8Encode(Application.ExeName)) +
    357       DirectorySeparator + POFilesFolder + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
     367    Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    358368      '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
    359369  end;
Note: See TracChangeset for help on using the changeset viewer.