Ignore:
Timestamp:
Sep 8, 2012, 9:28:39 PM (12 years ago)
Author:
chronos
Message:
  • Updated: Component versions.
  • Added: Missing forms.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33backup
        44tunneler.exe
         5heaptrclog.trc
  • trunk/Components/CoolTranslator

    • Property svn:ignore set to
      lib
  • trunk/Components/CoolTranslator/UCoolTranslator.pas

    r29 r30  
    1010
    1111type
     12  THandleStringEvent = function (AValue: string): string of object;
     13
    1214  { TComponentExcludes }
    1315
     
    3133  private
    3234    FLanguage: TLanguage;
     35    FOnAutomaticLanguage: THandleStringEvent;
    3336    FOnTranslate: TNotifyEvent;
    3437    FPOFilesFolder: string;
     
    4043    procedure ReloadFiles;
    4144    procedure SetPOFilesFolder(const AValue: string);
    42     procedure Translate;
    4345    procedure SetLanguage(const AValue: TLanguage);
    4446    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
     
    4749    ComponentExcludes: TComponentExcludesList;
    4850    Languages: TLanguageList;
     51    procedure Translate;
    4952    procedure LanguageListToStrings(Strings: TStrings);
    5053    procedure TranslateResourceStrings(PoFileName: string);
     
    6164    property Language: TLanguage read FLanguage write SetLanguage;
    6265    property OnTranslate: TNotifyEvent read FOnTranslate write FOnTranslate;
     66    property OnAutomaticLanguage: THandleStringEvent read FOnAutomaticLanguage
     67      write FOnAutomaticLanguage;
    6368  end;
    6469
     
    131136      for J := 0 to Items.Count - 1 do
    132137      with TPoFileItem(Items[J]) do
    133         Po.Add(Identifier, Original, Translation, Comments, Context,
     138        Po.Add(IdentifierLow, Original, Translation, Comments, Context,
    134139          Flags, PreviousID);
    135140    Translations.TranslateResourceStrings(Po);
     
    152157    //ShowMessage(ExtractFileDir(Application.ExeName) +
    153158    //  DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');
    154     FileList := FindAllFiles(ExtractFileDir(Application.ExeName) +
    155       DirectorySeparator + 'Languages', '*.' + LocaleShort + '.po');
     159    FileList := FindAllFiles(ExtractFileDir(UTF8Encode(Application.ExeName)) +
     160      DirectorySeparator + FPOFilesFolder, '*.' + LocaleShort + '.po');
    156161    for I := 0 to FileList.Count - 1 do begin
    157162      FileName := FileList[I];
     
    393398    LCLGetLanguageIDs(Lang, T);
    394399
     400  if Assigned(Language) and (Language.Code = '') and Assigned(FOnAutomaticLanguage) then begin
     401    Lang := FOnAutomaticLanguage(Lang);
     402  end;
     403
    395404  if Lang = 'en' then Lang := ''; // English files are without en code
     405
    396406  Result := Lang;
    397407end;
Note: See TracChangeset for help on using the changeset viewer.