Changeset 30 for trunk/Components/CoolTranslator/UCoolTranslator.pas
- Timestamp:
- Sep 8, 2012, 9:28:39 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 backup 4 4 tunneler.exe 5 heaptrclog.trc
-
- Property svn:ignore
-
trunk/Components/CoolTranslator
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
trunk/Components/CoolTranslator/UCoolTranslator.pas
r29 r30 10 10 11 11 type 12 THandleStringEvent = function (AValue: string): string of object; 13 12 14 { TComponentExcludes } 13 15 … … 31 33 private 32 34 FLanguage: TLanguage; 35 FOnAutomaticLanguage: THandleStringEvent; 33 36 FOnTranslate: TNotifyEvent; 34 37 FPOFilesFolder: string; … … 40 43 procedure ReloadFiles; 41 44 procedure SetPOFilesFolder(const AValue: string); 42 procedure Translate;43 45 procedure SetLanguage(const AValue: TLanguage); 44 46 procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo); … … 47 49 ComponentExcludes: TComponentExcludesList; 48 50 Languages: TLanguageList; 51 procedure Translate; 49 52 procedure LanguageListToStrings(Strings: TStrings); 50 53 procedure TranslateResourceStrings(PoFileName: string); … … 61 64 property Language: TLanguage read FLanguage write SetLanguage; 62 65 property OnTranslate: TNotifyEvent read FOnTranslate write FOnTranslate; 66 property OnAutomaticLanguage: THandleStringEvent read FOnAutomaticLanguage 67 write FOnAutomaticLanguage; 63 68 end; 64 69 … … 131 136 for J := 0 to Items.Count - 1 do 132 137 with TPoFileItem(Items[J]) do 133 Po.Add(Identifier , Original, Translation, Comments, Context,138 Po.Add(IdentifierLow, Original, Translation, Comments, Context, 134 139 Flags, PreviousID); 135 140 Translations.TranslateResourceStrings(Po); … … 152 157 //ShowMessage(ExtractFileDir(Application.ExeName) + 153 158 // 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'); 156 161 for I := 0 to FileList.Count - 1 do begin 157 162 FileName := FileList[I]; … … 393 398 LCLGetLanguageIDs(Lang, T); 394 399 400 if Assigned(Language) and (Language.Code = '') and Assigned(FOnAutomaticLanguage) then begin 401 Lang := FOnAutomaticLanguage(Lang); 402 end; 403 395 404 if Lang = 'en' then Lang := ''; // English files are without en code 405 396 406 Result := Lang; 397 407 end;
Note:
See TracChangeset
for help on using the changeset viewer.