Changeset 218


Ignore:
Timestamp:
Jan 22, 2022, 4:21:47 PM (7 months ago)
Author:
chronos
Message:
  • Fixed: Relative path detection for language files directory.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UTranslator.pas

    r215 r218  
    7575procedure Register;
    7676
     77const
     78  PoFileExt = '.po';
     79
    7780
    7881implementation
     
    170173  try
    171174    LocaleShort := GetLocaleShort;
    172     //ShowMessage(ExtractFileDir(Application.ExeName) +
    173     //  DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');
    174175    SearchMask := '*';
    175176    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
    176     SearchMask := SearchMask + '.po';
     177    SearchMask := SearchMask + PoFileExt;
    177178    FileList := FindAllFiles(GetLangFileDir, SearchMask);
    178179    for I := 0 to FileList.Count - 1 do begin
    179180      FileName := FileList[I];
    180       //FileName := FindLocaleFileName('.po');
    181181      if FileExists(FileName) and (
    182       ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or
     182      ((LocaleShort = '') and (Pos('.', FileName) = Pos(PoFileExt, FileName))) or
    183183      (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName));
    184184    end;
     
    245245  I: Integer;
    246246begin
    247 
    248247//  PropInfo^.Name;
    249248  // Using IsDefaultPropertyValue will tell us if we should write out
     
    290289  Item := Component.ClassType;
    291290  while Assigned(Item) do begin
    292     //ShowMessage(Component.Name + ', ' + Component.ClassName + ', ' + Item.ClassName + ', ' + PropertyName);
    293291    Excludes := ComponentExcludes.FindByClassType(Item.ClassType);
    294292    if Assigned(Excludes) then begin
     
    305303begin
    306304  Result := FPoFilesFolder;
    307   if Copy(Result, 1, 1) <> DirectorySeparator then
    308     Result := ExtractFileDir(Application.ExeName) +
    309       DirectorySeparator + Result;
     305  if not FilenameIsAbsolute(Result) then
     306    Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Result;
    310307end;
    311308
     
    382379  with Languages[I] do begin
    383380    Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    384       '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
     381      '.' + Code + PoFileExt) or (Code = 'en');
    385382  end;
    386383end;
     
    471468
    472469  begin
    473 
    474470    // ParamStrUTF8(0) is said not to work properly in linux, but I've tested it
    475471    Result := ExtractFilePath(ParamStrUTF8(0)) + LangID +
Note: See TracChangeset for help on using the changeset viewer.