Changeset 159 for trunk


Ignore:
Timestamp:
Jun 12, 2023, 11:46:36 PM (19 months ago)
Author:
chronos
Message:
  • Modified: Support multiple translator PO directories.
Location:
trunk
Files:
1 added
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Core.lfm

    r158 r159  
    85448544  end
    85458545  object Translator: TTranslator
    8546     POFilesFolder = 'Languages'
     8546    POFilesFolder = 'Languages;Packages/Common/Languages;Packages/VCard/Languages'
    85478547    OnTranslate = TranslatorTranslate
    85488548    Left = 115
  • trunk/Forms/FormCompareSideBySide.lfm

    r155 r159  
    55  Width = 1191
    66  Caption = 'Compare side by side'
    7   ClientHeight = 858
     7  ClientHeight = 854
    88  ClientWidth = 1191
    99  DesignTimePPI = 144
     
    1818  object PanelLeft: TPanel
    1919    Left = 0
    20     Height = 858
     20    Height = 854
    2121    Top = 0
    2222    Width = 584
    2323    Align = alLeft
    2424    BevelOuter = bvNone
    25     ClientHeight = 858
     25    ClientHeight = 854
    2626    ClientWidth = 584
    2727    TabOrder = 0
    2828    object EditLeftFileName: TEdit
    2929      Left = 15
    30       Height = 33
     30      Height = 43
    3131      Top = 11
    3232      Width = 523
     
    3737    inline SynEditLeft: TSynEditEx
    3838      Left = 15
    39       Height = 785
     39      Height = 781
    4040      Top = 61
    4141      Width = 562
     
    4848      ParentFont = False
    4949      TabOrder = 1
    50       Gutter.Width = 73
     50      Gutter.Width = 75
    5151      Gutter.MouseActions = <>
    5252      RightGutter.Width = 0
     
    503503        end
    504504        object SynGutterLineNumber1: TSynGutterLineNumber
    505           Width = 13
     505          Width = 15
    506506          MouseActions = <>
    507507          MarkupInfo.Background = clBtnFace
     
    548548  object Splitter1: TSplitter
    549549    Left = 584
    550     Height = 858
     550    Height = 854
    551551    Top = 0
    552552    Width = 8
     
    554554  object PanelRight: TPanel
    555555    Left = 592
    556     Height = 858
     556    Height = 854
    557557    Top = 0
    558558    Width = 599
    559559    Align = alClient
    560560    BevelOuter = bvNone
    561     ClientHeight = 858
     561    ClientHeight = 854
    562562    ClientWidth = 599
    563563    TabOrder = 2
    564564    object EditRightFileName: TEdit
    565565      Left = 12
    566       Height = 33
     566      Height = 43
    567567      Top = 11
    568568      Width = 527
     
    573573    inline SynEditRight: TSynEditEx
    574574      Left = 15
    575       Height = 785
     575      Height = 781
    576576      Top = 61
    577577      Width = 571
     
    584584      ParentFont = False
    585585      TabOrder = 1
    586       Gutter.Width = 73
     586      Gutter.Width = 75
    587587      Gutter.MouseActions = <>
    588588      RightGutter.Width = 0
     
    10391039        end
    10401040        object SynGutterLineNumber1: TSynGutterLineNumber
    1041           Width = 13
     1041          Width = 15
    10421042          MouseActions = <>
    10431043          MarkupInfo.Background = clBtnFace
  • trunk/Forms/FormCompareSideBySide.pas

    r151 r159  
    77  VCard, Diff, LCLType, LCLIntf, ComCtrls, Buttons, Menus, ActnList, SynEdit,
    88  SynEditMiscClasses, SynHighlighterPosition, SynEditHighlighter, Common,
    9   USynEditEx;
     9  SynEditEx;
    1010
    1111type
  • trunk/Forms/FormContacts.pas

    r157 r159  
    384384begin
    385385  LoadFromRegistry(Context);
    386   UpdateColumns;
    387386  Core.Core.Translator.TranslateComponentRecursive(Self);
    388387  Core.Core.ThemeManager1.UseTheme(Self);
    389388  Core.Core.PersistentForm1.Load(Self);
     389  UpdateColumns;
    390390  ReloadList;
    391391  UpdateInterface;
  • trunk/Forms/FormExport.lfm

    r158 r159  
    4141    Top = 9
    4242    Width = 805
    43     HorzScrollBar.Page = 521
     43    HorzScrollBar.Page = 473
    4444    VertScrollBar.Page = 225
    4545    Anchors = [akTop, akLeft, akRight, akBottom]
     
    5656    end
    5757    object ComboBoxOutputFormat: TComboBox
    58       Left = 256
     58      Left = 208
    5959      Height = 42
    6060      Top = 76
     
    7575    end
    7676    object EditOutputFile: TEdit
    77       Left = 139
     77      Left = 208
    7878      Height = 43
    7979      Top = 24
    80       Width = 533
     80      Width = 464
    8181      Anchors = [akTop, akLeft, akRight]
    8282      TabOrder = 1
  • trunk/Packages/Common/Translator.pas

    r148 r159  
    4848    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
    4949    function IsExcluded(Component: TPersistent; PropertyName: string): Boolean;
    50     function GetLangFileDir: string;
     50    function GetLangFileDirs: TStrings;
    5151  public
    5252    ComponentExcludes: TComponentExcludesList;
     
    7171  end;
    7272
     73const
     74  PoExt = '.po';
     75
    7376procedure Register;
    7477
    7578
    7679implementation
     80
     81uses
     82  Common;
    7783
    7884procedure Register;
     
    161167  FileList: TStringList;
    162168  I: Integer;
     169  J: Integer;
    163170  LocaleShort: string;
    164171  SearchMask: string;
     172  LangDirs: TStrings;
    165173begin
    166174  FPoFiles.Clear;
     
    172180    SearchMask := '*';
    173181    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
    174     SearchMask := SearchMask + '.po';
    175     FileList := FindAllFiles(GetLangFileDir, SearchMask);
    176     for I := 0 to FileList.Count - 1 do begin
    177       FileName := FileList[I];
    178       //FileName := FindLocaleFileName('.po');
    179       if FileExists(FileName) and (
    180       ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or
    181       (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName));
    182     end;
     182    SearchMask := SearchMask + PoExt;
     183    LangDirs := GetLangFileDirs;
     184    for J := 0 to LangDirs.Count - 1 do begin
     185      FileList := FindAllFiles(LangDirs[J], SearchMask);
     186      for I := 0 to FileList.Count - 1 do begin
     187        FileName := FileList[I];
     188        //FileName := FindLocaleFileName('.po');
     189        if FileExists(FileName) and (
     190        ((LocaleShort = '') and (Pos('.', FileName) = Pos(PoExt, FileName))) or
     191        (LocaleShort <> '')) then FPoFiles.Add(TPOFile.Create(FileName));
     192      end;
     193    end;
     194    LangDirs.Free;
    183195  finally
    184196    FileList.Free;
     
    299311end;
    300312
    301 function TTranslator.GetLangFileDir: string;
    302 begin
    303   Result := FPoFilesFolder;
    304   if Copy(Result, 1, 1) <> DirectorySeparator then
    305     Result := ExtractFileDir(Application.ExeName) +
    306       DirectorySeparator + Result;
     313function TTranslator.GetLangFileDirs: TStrings;
     314var
     315  I: Integer;
     316begin
     317  Result := TStringList.Create;
     318  Result.Delimiter := ';';
     319  Result.StrictDelimiter := True;
     320  Result.DelimitedText := FPoFilesFolder;
     321
     322  for I := 0 to Result.Count - 1 do begin
     323    Result[I] := StringReplace(Result[I], '/', DirectorySeparator, [rfReplaceAll]);
     324    Result[I] := StringReplace(Result[I], '\', DirectorySeparator, [rfReplaceAll]);
     325    if Copy(Result[I], 1, 1) <> DirectorySeparator then
     326      Result[I] := ExtractFileDir(Application.ExeName) +
     327        DirectorySeparator + Result[I];
     328  end;
    307329end;
    308330
     
    371393var
    372394  I: Integer;
    373   LangDir: string;
    374 begin
    375   LangDir := GetLangFileDir;
     395  J: Integer;
     396  LangDirs: TStrings;
     397begin
     398  LangDirs := GetLangFileDirs;
    376399  Languages.SearchByCode('').Available := True; // Automatic
    377400
    378401  for I := 1 to Languages.Count - 1 do
    379402  with Languages[I] do begin
    380     Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    381       '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
    382   end;
     403    for J := 0 to LangDirs.Count - 1 do begin
     404      if FileExists(LangDirs[J] + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
     405        '.' + Code + PoExt) or (Code = 'en') then begin
     406          Available := True;
     407          Continue;
     408        end;
     409    end;
     410  end;
     411  LangDirs.Free;
    383412end;
    384413
  • trunk/Packages/SynEditEx/SynEditEx.lpk

    r128 r159  
    3030    <Files>
    3131      <Item>
    32         <Filename Value="USynEditEx.pas"/>
     32        <Filename Value="SynEditEx.pas"/>
    3333        <HasRegisterProc Value="True"/>
    34         <UnitName Value="USynEditEx"/>
     34        <UnitName Value="SynEditEx"/>
     35      </Item>
     36      <Item>
     37        <Filename Value="SynEditExPackage.pas"/>
     38        <Type Value="Main Unit"/>
     39        <UnitName Value="SynEditExPackage"/>
    3540      </Item>
    3641    </Files>
  • trunk/Packages/SynEditEx/SynEditEx.pas

    r158 r159  
    1 unit USynEditEx;
     1unit SynEditEx;
    22
    33interface
     
    2828end;
    2929
    30 
    3130{ TSynEditEx }
    3231
     
    3837end;
    3938
    40 
    4139end.
    4240
Note: See TracChangeset for help on using the changeset viewer.