Changeset 229 for CoolTranslator
- Timestamp:
- Apr 7, 2011, 9:24:06 AM (14 years ago)
- Location:
- CoolTranslator
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolTranslator/CoolTranslator.lpk
r228 r229 18 18 <License Value="GNU/GPL"/> 19 19 <Version Minor="1"/> 20 <Files Count=" 2">20 <Files Count="3"> 21 21 <Item1> 22 22 <Filename Value="UCoolTranslator.pas"/> … … 28 28 <UnitName Value="ULanguages"/> 29 29 </Item2> 30 <Item3> 31 <Filename Value="ReadMe.txt"/> 32 <Type Value="Text"/> 33 </Item3> 30 34 </Files> 31 35 <i18n> -
CoolTranslator/UCoolTranslator.pas
r228 r229 7 7 uses 8 8 Classes, SysUtils, Forms, StdCtrls, ExtCtrls, StrUtils, Controls, Contnrs, 9 Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages ;9 Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType; 10 10 11 11 type … … 52 52 function TranslateText(Identifier, Text: string): string; 53 53 procedure AddExcludes(AClassType: TClass; PropertyName: string); 54 procedure CheckLanguageFiles; 54 55 constructor Create(AOwner: TComponent); override; 55 56 destructor Destroy; override; … … 116 117 procedure TCoolTranslator.Translate; 117 118 begin 119 TranslateResourceStrings('ULanguages.cs.po'); 118 120 TranslateComponentRecursive(Application); 119 121 if Assigned(FPOFile) then … … 205 207 case PropType^.Kind of 206 208 tkString, tkLString, tkWString, tkAString: begin 207 if not IsExcluded(Component, PropInfo^.Name) then 209 if (UpperCase(PropType.Name) = 'TTRANSLATESTRING') then 210 //if not IsExcluded(Component, PropInfo^.Name) then 208 211 SetStrProp(Component, PropInfo, TranslateText(PropInfo^.Name, GetWideStrProp(Component, PropInfo))); 209 212 end; … … 214 217 with TCollection(Obj).Items[I] do 215 218 TranslateComponent(TCollection(Obj).Items[I]); 219 if Obj is TStrings then 220 for I := 0 to TStrings(Obj).Count - 1 do 221 with TStrings(Obj) do 222 Strings[I] := TranslateText(Strings[I], Strings[I]); 216 223 end; 217 224 end; … … 245 252 var 246 253 I: Integer; 254 ItemName: string; 247 255 begin 248 256 with Strings do begin 249 257 Clear; 250 for I := 0 to Languages.Count - 1 do begin 251 AddObject(TLanguage(Languages[I]).Name, Languages[I]); 252 end; 258 for I := 0 to Languages.Count - 1 do 259 with TLanguage(Languages[I]) do 260 if Available then begin 261 ItemName := Name; 262 if Code <> '' then ItemName := ItemName + ' (' + Code + ')'; 263 AddObject(ItemName, Languages[I]); 264 end; 253 265 end; 254 266 end; … … 286 298 end; 287 299 300 procedure TCoolTranslator.CheckLanguageFiles; 301 var 302 I: Integer; 303 begin 304 TLanguage(Languages[0]).Available := True; // Automatic 305 306 for I := 1 to Languages.Count - 1 do 307 with TLanguage(Languages[I]) do begin 308 Available := FileExistsUTF8(POFilesFolder + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) + 309 '.' + Code + ExtensionSeparator + 'po') or (Code = 'en'); 310 end; 311 end; 312 288 313 constructor TCoolTranslator.Create(AOwner: TComponent); 289 314 begin … … 292 317 Languages := TLanguageList.Create; 293 318 POFilesFolder := 'Languages'; 319 CheckLanguageFiles; 294 320 295 321 // LCL -
CoolTranslator/ULanguages.pas
r228 r229 12 12 Name: string; 13 13 Code: string; 14 Available: Boolean; 14 15 end; 15 16
Note:
See TracChangeset
for help on using the changeset viewer.