Ignore:
Timestamp:
May 30, 2023, 11:31:10 AM (18 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from unit names.
File:
1 moved

Legend:

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

    r455 r456  
    1 unit UTranslator;
     1unit Translator;
    22
    33interface
     
    55uses
    66  Classes, SysUtils, Forms, ExtCtrls, Controls, LazFileUtils, LazUTF8,
    7   Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType,
     7  Translations, TypInfo, Dialogs, FileUtil, LCLProc, Languages, LCLType,
    88  LCLVersion, Generics.Collections;
    99
     
    420420
    421421  if Lang = '' then begin
    422     for I := 1 to Paramcount - 1 do
    423       if (ParamStr(I) = '--LANG') or (ParamStr(I) = '-l') or
    424         (ParamStr(I) = '--lang') then
    425         Lang := ParamStr(I + 1);
     422    for i := 1 to Paramcount - 1 do
     423      if (ParamStr(i) = '--LANG') or (ParamStr(i) = '-l') or
     424        (ParamStr(i) = '--lang') then
     425        Lang := ParamStr(i + 1);
    426426  end;
    427427  if Lang = '' then begin
     
    473473      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    474474    if FileExistsUTF8(Result) then
    475       Exit;
     475      exit;
    476476
    477477    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator + LangID +
    478478      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    479479    if FileExistsUTF8(Result) then
    480       Exit;
     480      exit;
    481481
    482482    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
    483483      + LangID + DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    484484    if FileExistsUTF8(Result) then
    485       Exit;
     485      exit;
    486486
    487487    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    489489      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    490490    if FileExistsUTF8(Result) then
    491       Exit;
     491      exit;
    492492
    493493    {$IFDEF UNIX}
     
    496496      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    497497    if FileExistsUTF8(Result) then
    498       Exit;
     498      exit;
    499499    {$ENDIF}
    500500    // Let us search for reducted files
    501     LangShortID := Copy(LangID, 1, 2);
     501    LangShortID := copy(LangID, 1, 2);
    502502    // At first, check all was checked
    503503    Result := ExtractFilePath(ParamStrUTF8(0)) + LangShortID +
    504504      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    505505    if FileExistsUTF8(Result) then
    506       Exit;
     506      exit;
    507507
    508508    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator +
     
    510510      ExtractFileName(ParamStrUTF8(0)), LCExt);
    511511    if FileExistsUTF8(Result) then
    512       Exit;
     512      exit;
    513513
    514514    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    516516      ExtractFileName(ParamStrUTF8(0)), LCExt);
    517517    if FileExistsUTF8(Result) then
    518       Exit;
     518      exit;
    519519
    520520    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    522522      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    523523    if FileExistsUTF8(Result) then
    524       Exit;
     524      exit;
    525525
    526526    // Full language in file name - this will be default for the project
     
    529529      Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    530530      if FileExistsUTF8(Result) then
    531         Exit;
     531        exit;
    532532      // Common location (like in Lazarus)
    533533      Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator +
    534534        ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    535535      if FileExistsUTF8(Result) then
    536         Exit;
     536        exit;
    537537
    538538      Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' +
    539539        DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    540540      if FileExistsUTF8(Result) then
    541         Exit;
     541        exit;
    542542    except
    543543      Result := ''; // Or do something else (useless)
     
    548548      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    549549    if FileExistsUTF8(Result) then
    550       Exit;
     550      exit;
    551551    {$ENDIF}
    552552    Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt(
    553553      ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    554554    if FileExistsUTF8(Result) then
    555       Exit;
     555      exit;
    556556
    557557    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator +
    558558      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    559559    if FileExistsUTF8(Result) then
    560       Exit;
     560      exit;
    561561
    562562    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator +
    563563      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    564564    if FileExistsUTF8(Result) then
    565       Exit;
     565      exit;
    566566  end;
    567567
     
    569569end;
    570570
    571 
    572571end.
    573 
Note: See TracChangeset for help on using the changeset viewer.