Changeset 306


Ignore:
Timestamp:
Jan 3, 2012, 10:34:03 AM (13 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • CoolTranslator/UCoolTranslator.pas

    r287 r306  
    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;
     
    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);
     
    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.