Changeset 30 for trunk/Components/CoolTranslator
- Timestamp:
- Sep 8, 2012, 9:28:39 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 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/Demo/Languages/TranslatorDemo.cs.po
r29 r30 19 19 msgstr "Ukázat MainForm.Name" 20 20 21 #: TMAINFORM.CAPTION 22 msgctxt "TMAINFORM.CAPTION" 23 msgid "Translator Demo" 24 msgstr "Ukázka Translatoru" 25 21 26 #: TMAINFORM.LABEL1.CAPTION 22 27 msgid "MainForm" … … 35 40 msgstr "" 36 41 37 #: TMAINFORM.MAINFORM.CAPTION38 msgctxt "TMAINFORM.MAINFORM.CAPTION"39 msgid "Translator Demo"40 msgstr "Ukázka Translatoru"41 42 42 #: umainform.stranslatedtext 43 43 msgid "Text stored in resourcestring" -
trunk/Components/CoolTranslator/Demo/Languages/TranslatorDemo.de.po
r29 r30 9 9 #: TMAINFORM.BUTTON1.CAPTION 10 10 msgid "Show MainForm.Name" 11 msgstr "" 12 13 #: TMAINFORM.CAPTION 14 msgctxt "TMAINFORM.CAPTION" 15 msgid "Translator Demo" 11 16 msgstr "" 12 17 … … 27 32 msgstr "" 28 33 29 #: TMAINFORM.MAINFORM.CAPTION30 msgctxt "TMAINFORM.MAINFORM.CAPTION"31 msgid "Translator Demo"32 msgstr ""33 34 34 #: umainform.stranslatedtext 35 35 msgid "Text stored in resourcestring" -
trunk/Components/CoolTranslator/Demo/Languages/TranslatorDemo.po
r29 r30 9 9 #: TMAINFORM.BUTTON1.CAPTION 10 10 msgid "Show MainForm.Name" 11 msgstr "" 12 13 #: TMAINFORM.CAPTION 14 msgctxt "TMAINFORM.CAPTION" 15 msgid "Translator Demo" 11 16 msgstr "" 12 17 … … 27 32 msgstr "" 28 33 29 #: TMAINFORM.MAINFORM.CAPTION30 msgctxt "TMAINFORM.MAINFORM.CAPTION"31 msgid "Translator Demo"32 msgstr ""33 34 34 #: umainform.stranslatedtext 35 35 msgid "Text stored in resourcestring" -
trunk/Components/CoolTranslator/Demo/TranslatorDemo.lpi
r29 r30 40 40 </Item2> 41 41 </RequiredPackages> 42 <Units Count="1 1">42 <Units Count="12"> 43 43 <Unit0> 44 44 <Filename Value="TranslatorDemo.lpr"/> … … 55 55 <EditorIndex Value="0"/> 56 56 <WindowIndex Value="0"/> 57 <TopLine Value=" 39"/>58 <CursorPos X=" 45" Y="48"/>57 <TopLine Value="1"/> 58 <CursorPos X="29" Y="18"/> 59 59 <UsageCount Value="21"/> 60 60 <Loaded Value="True"/> … … 64 64 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\stdctrls.pp"/> 65 65 <UnitName Value="StdCtrls"/> 66 <EditorIndex Value="8"/>67 66 <WindowIndex Value="0"/> 68 67 <TopLine Value="565"/> 69 68 <CursorPos X="24" Y="577"/> 70 69 <UsageCount Value="11"/> 71 <Loaded Value="True"/>72 70 </Unit2> 73 71 <Unit3> 74 72 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\FPC\rtl\objpas\classes\classesh.inc"/> 75 <EditorIndex Value="9"/>76 73 <WindowIndex Value="0"/> 77 74 <TopLine Value="686"/> 78 75 <CursorPos X="3" Y="659"/> 79 76 <UsageCount Value="11"/> 80 <Loaded Value="True"/>81 77 </Unit3> 82 78 <Unit4> 83 79 <Filename Value="..\UCoolTranslator.pas"/> 84 80 <UnitName Value="UCoolTranslator"/> 85 <EditorIndex Value="3"/> 81 <IsVisibleTab Value="True"/> 82 <EditorIndex Value="1"/> 86 83 <WindowIndex Value="0"/> 87 84 <TopLine Value="274"/> 88 <CursorPos X=" 29" Y="279"/>85 <CursorPos X="1" Y="286"/> 89 86 <UsageCount Value="11"/> 90 87 <Loaded Value="True"/> … … 92 89 <Unit5> 93 90 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\include\customlistbox.inc"/> 94 <EditorIndex Value="2"/>95 91 <WindowIndex Value="0"/> 96 92 <TopLine Value="524"/> 97 93 <CursorPos X="1" Y="535"/> 98 94 <UsageCount Value="10"/> 99 <Loaded Value="True"/>100 95 </Unit5> 101 96 <Unit6> 102 97 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\interfaces\win32\win32listsl.inc"/> 103 <EditorIndex Value="1"/>104 98 <WindowIndex Value="0"/> 105 99 <TopLine Value="226"/> 106 100 <CursorPos X="1" Y="238"/> 107 101 <UsageCount Value="10"/> 108 <Loaded Value="True"/>109 102 </Unit6> 110 103 <Unit7> 111 104 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\include\winfileutil.inc"/> 112 <EditorIndex Value="6"/>113 105 <WindowIndex Value="0"/> 114 106 <TopLine Value="549"/> 115 107 <CursorPos X="1" Y="566"/> 116 108 <UsageCount Value="10"/> 117 <Loaded Value="True"/>118 109 </Unit7> 119 110 <Unit8> 120 111 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\translations.pas"/> 121 112 <UnitName Value="Translations"/> 122 <IsVisibleTab Value="True"/>123 <EditorIndex Value="7"/>124 113 <WindowIndex Value="0"/> 125 114 <TopLine Value="747"/> 126 115 <CursorPos X="54" Y="759"/> 127 116 <UsageCount Value="10"/> 128 <Loaded Value="True"/>129 117 </Unit8> 130 118 <Unit9> 131 119 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\include\control.inc"/> 132 <EditorIndex Value="5"/>133 120 <WindowIndex Value="0"/> 134 121 <TopLine Value="2702"/> 135 122 <CursorPos X="18" Y="2717"/> 136 123 <UsageCount Value="10"/> 137 <Loaded Value="True"/>138 124 </Unit9> 139 125 <Unit10> 140 126 <Filename Value="E:\Projekty2\FreePascalManager\trunk\Instance\5\FPC\rtl\inc\objpash.inc"/> 141 <EditorIndex Value="4"/>142 127 <WindowIndex Value="0"/> 143 128 <TopLine Value="189"/> 144 129 <CursorPos X="26" Y="201"/> 145 130 <UsageCount Value="10"/> 131 </Unit10> 132 <Unit11> 133 <Filename Value="..\ULanguages.pas"/> 134 <UnitName Value="ULanguages"/> 135 <EditorIndex Value="2"/> 136 <WindowIndex Value="0"/> 137 <TopLine Value="1"/> 138 <CursorPos X="32" Y="10"/> 139 <UsageCount Value="10"/> 146 140 <Loaded Value="True"/> 147 </Unit1 0>141 </Unit11> 148 142 </Units> 149 143 <JumpHistory Count="30" HistoryIndex="29"> … … 253 247 </Position26> 254 248 <Position27> 255 <Filename Value=" E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\translations.pas"/>256 <Caret Line=" 759" Column="1" TopLine="747"/>249 <Filename Value="UMainForm.pas"/> 250 <Caret Line="48" Column="45" TopLine="39"/> 257 251 </Position27> 258 252 <Position28> 259 <Filename Value=" E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\translations.pas"/>260 <Caret Line=" 760" Column="1" TopLine="747"/>253 <Filename Value="UMainForm.pas"/> 254 <Caret Line="59" Column="20" TopLine="39"/> 261 255 </Position28> 262 256 <Position29> 263 <Filename Value=" E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\translations.pas"/>264 <Caret Line=" 761" Column="1" TopLine="747"/>257 <Filename Value="UMainForm.pas"/> 258 <Caret Line="9" Column="29" TopLine="1"/> 265 259 </Position29> 266 260 <Position30> 267 <Filename Value=" E:\Projekty2\FreePascalManager\trunk\Instance\5\Lazarus\lcl\translations.pas"/>268 <Caret Line=" 762" Column="1" TopLine="747"/>261 <Filename Value="UMainForm.pas"/> 262 <Caret Line="18" Column="29" TopLine="1"/> 269 263 </Position30> 270 264 </JumpHistory> 271 265 </ProjectOptions> 272 266 <CompilerOptions> 273 <Version Value=" 9"/>267 <Version Value="10"/> 274 268 <PathDelim Value="\"/> 275 269 <Target> … … 281 275 </SearchPaths> 282 276 <Linking> 277 <Debugging> 278 <GenerateDebugInfo Value="True"/> 279 <DebugInfoType Value="dsAuto"/> 280 </Debugging> 283 281 <Options> 284 282 <Win32> … … 295 293 </CompilerOptions> 296 294 <Debugging> 297 <BreakPoints Count="1">298 <Item1>299 <Source Value="..\UCoolTranslator.pas"/>300 <Line Value="279"/>301 </Item1>302 </BreakPoints>303 295 <Exceptions Count="3"> 304 296 <Item1> -
trunk/Components/CoolTranslator/Demo/UMainForm.lfm
r29 r30 8 8 ClientWidth = 466 9 9 OnCreate = FormCreate 10 LCLVersion = '0.9.3 0.1'10 LCLVersion = '0.9.31' 11 11 object ListBox1: TListBox 12 12 Left = 171 … … 68 68 end 69 69 object CoolTranslator1: TCoolTranslator 70 POFilesFolder = 'Languages' 70 71 left = 64 71 72 top = 40 -
trunk/Components/CoolTranslator/Demo/UMainForm.lrt
r29 r30 1 TMAINFORM. MAINFORM.CAPTION=Translator Demo1 TMAINFORM.CAPTION=Translator Demo 2 2 TMAINFORM.BUTTON1.CAPTION=Show MainForm.Name 3 3 TMAINFORM.LABEL1.CAPTION=MainForm -
trunk/Components/CoolTranslator/Demo/UMainForm.pas
r29 r30 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 UCoolTranslator ;9 UCoolTranslator, ULanguages; 10 10 11 11 type -
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.