Changeset 9 for tools


Ignore:
Timestamp:
Jan 15, 2009, 9:47:30 AM (16 years ago)
Author:
george
Message:
  • Upraveno: Program přepracován pro podporu více překladových souborů a hromadného sloučení s novějšími anglickými verzemi z repozitáře Lazarusu.
  • Upraveno: Adresářová struktura překladových souborů přepracována tak, aby souhlasila se strukturou adresářů repozitáře Lazarusu.
  • Upraveno: Překladové soubory aktualizovány na SVN verzi 0.9.27.
Location:
tools/Lazarus translator
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • tools/Lazarus translator/Translator.lpi

    r7 r9  
    1212    <VersionInfo>
    1313      <ProjectVersion Value=""/>
    14       <Language Value=""/>
    15       <CharSet Value=""/>
    1614    </VersionInfo>
    1715    <PublishOptions>
     
    3230      </Item1>
    3331    </RequiredPackages>
    34     <Units Count="17">
     32    <Units Count="19">
    3533      <Unit0>
    3634        <Filename Value="Translator.lpr"/>
    3735        <IsPartOfProject Value="True"/>
    3836        <UnitName Value="Translator"/>
    39         <CursorPos X="30" Y="8"/>
     37        <CursorPos X="69" Y="18"/>
    4038        <TopLine Value="1"/>
    41         <EditorIndex Value="1"/>
    42         <UsageCount Value="36"/>
     39        <EditorIndex Value="2"/>
     40        <UsageCount Value="40"/>
    4341        <Loaded Value="True"/>
    4442      </Unit0>
    4543      <Unit1>
    46         <Filename Value="UMainForm.pas"/>
    47         <ComponentName Value="MainForm"/>
     44        <Filename Value="UItemListForm.pas"/>
     45        <ComponentName Value="ItemListForm"/>
    4846        <IsPartOfProject Value="True"/>
    4947        <ResourceBaseClass Value="Form"/>
    50         <ResourceFilename Value="UMainForm.lrs"/>
    51         <UnitName Value="UMainForm"/>
    52         <CursorPos X="25" Y="190"/>
    53         <TopLine Value="180"/>
     48        <ResourceFilename Value="UItemListForm.lrs"/>
     49        <UnitName Value="UItemListForm"/>
     50        <CursorPos X="11" Y="339"/>
     51        <TopLine Value="324"/>
    5452        <EditorIndex Value="0"/>
    55         <UsageCount Value="36"/>
     53        <UsageCount Value="40"/>
    5654        <Loaded Value="True"/>
    5755      </Unit1>
     
    6361        <ResourceFilename Value="UItemTranslationForm.lrs"/>
    6462        <UnitName Value="UItemTranslationForm"/>
    65         <CursorPos X="23" Y="15"/>
    66         <TopLine Value="8"/>
    67         <EditorIndex Value="2"/>
    68         <UsageCount Value="36"/>
     63        <CursorPos X="8" Y="36"/>
     64        <TopLine Value="16"/>
     65        <EditorIndex Value="3"/>
     66        <UsageCount Value="40"/>
    6967        <Loaded Value="True"/>
    7068      </Unit2>
     
    7573        <CursorPos X="1" Y="49"/>
    7674        <TopLine Value="43"/>
    77         <UsageCount Value="36"/>
     75        <UsageCount Value="40"/>
    7876      </Unit3>
    7977      <Unit4>
     
    9795      <Unit7>
    9896        <Filename Value="..\..\..\..\..\..\Lazarus\fpc\2.2.2\source\rtl\objpas\sysutils\filutilh.inc"/>
    99         <CursorPos X="10" Y="77"/>
    100         <TopLine Value="64"/>
     97        <CursorPos X="19" Y="78"/>
     98        <TopLine Value="69"/>
    10199        <UsageCount Value="11"/>
    102100      </Unit7>
     
    104102        <Filename Value="..\..\..\..\..\..\Lazarus\fpc\2.2.2\source\rtl\win\sysutils.pp"/>
    105103        <UnitName Value="sysutils"/>
    106         <CursorPos X="9" Y="256"/>
    107         <TopLine Value="252"/>
     104        <CursorPos X="11" Y="34"/>
     105        <TopLine Value="13"/>
    108106        <UsageCount Value="11"/>
    109107      </Unit8>
     
    142140      <Unit14>
    143141        <Filename Value="..\..\..\..\..\..\Lazarus\fpc\2.2.2\source\rtl\objpas\sysutils\sysstrh.inc"/>
    144         <CursorPos X="10" Y="83"/>
    145         <TopLine Value="70"/>
     142        <CursorPos X="10" Y="199"/>
     143        <TopLine Value="186"/>
    146144        <UsageCount Value="13"/>
    147145      </Unit14>
     
    159157        <UsageCount Value="10"/>
    160158      </Unit16>
     159      <Unit17>
     160        <Filename Value="..\..\..\..\..\..\Lazarus\fpc\2.2.2\source\rtl\objpas\sysutils\sysutilh.inc"/>
     161        <CursorPos X="12" Y="226"/>
     162        <TopLine Value="212"/>
     163        <UsageCount Value="10"/>
     164      </Unit17>
     165      <Unit18>
     166        <Filename Value="UMainForm.pas"/>
     167        <ComponentName Value="MainForm"/>
     168        <IsPartOfProject Value="True"/>
     169        <ResourceBaseClass Value="Form"/>
     170        <ResourceFilename Value="UMainForm.lrs"/>
     171        <UnitName Value="UMainForm"/>
     172        <CursorPos X="36" Y="67"/>
     173        <TopLine Value="56"/>
     174        <EditorIndex Value="1"/>
     175        <UsageCount Value="22"/>
     176        <Loaded Value="True"/>
     177      </Unit18>
    161178    </Units>
    162179    <JumpHistory Count="30" HistoryIndex="29">
    163180      <Position1>
    164         <Filename Value="UMainForm.pas"/>
    165         <Caret Line="132" Column="1" TopLine="119"/>
     181        <Filename Value="UItemListForm.pas"/>
     182        <Caret Line="334" Column="1" TopLine="321"/>
    166183      </Position1>
    167184      <Position2>
    168         <Filename Value="UMainForm.pas"/>
    169         <Caret Line="135" Column="1" TopLine="122"/>
     185        <Filename Value="UItemListForm.pas"/>
     186        <Caret Line="328" Column="1" TopLine="315"/>
    170187      </Position2>
    171188      <Position3>
    172         <Filename Value="UMainForm.pas"/>
    173         <Caret Line="136" Column="27" TopLine="124"/>
     189        <Filename Value="UItemListForm.pas"/>
     190        <Caret Line="329" Column="1" TopLine="316"/>
    174191      </Position3>
    175192      <Position4>
    176         <Filename Value="UMainForm.pas"/>
    177         <Caret Line="12" Column="20" TopLine="1"/>
     193        <Filename Value="UItemListForm.pas"/>
     194        <Caret Line="330" Column="1" TopLine="317"/>
    178195      </Position4>
    179196      <Position5>
    180         <Filename Value="UMainForm.pas"/>
    181         <Caret Line="167" Column="70" TopLine="154"/>
     197        <Filename Value="UItemListForm.pas"/>
     198        <Caret Line="331" Column="1" TopLine="318"/>
    182199      </Position5>
    183200      <Position6>
    184         <Filename Value="UMainForm.pas"/>
    185         <Caret Line="29" Column="48" TopLine="28"/>
     201        <Filename Value="UItemListForm.pas"/>
     202        <Caret Line="332" Column="1" TopLine="319"/>
    186203      </Position6>
    187204      <Position7>
    188         <Filename Value="UMainForm.pas"/>
    189         <Caret Line="134" Column="13" TopLine="131"/>
     205        <Filename Value="UItemListForm.pas"/>
     206        <Caret Line="328" Column="1" TopLine="315"/>
    190207      </Position7>
    191208      <Position8>
    192         <Filename Value="UMainForm.pas"/>
    193         <Caret Line="45" Column="22" TopLine="31"/>
     209        <Filename Value="UItemListForm.pas"/>
     210        <Caret Line="329" Column="1" TopLine="316"/>
    194211      </Position8>
    195212      <Position9>
    196         <Filename Value="UMainForm.pas"/>
    197         <Caret Line="176" Column="54" TopLine="169"/>
     213        <Filename Value="UItemListForm.pas"/>
     214        <Caret Line="334" Column="1" TopLine="321"/>
    198215      </Position9>
    199216      <Position10>
    200         <Filename Value="UMainForm.pas"/>
    201         <Caret Line="159" Column="1" TopLine="145"/>
     217        <Filename Value="UItemListForm.pas"/>
     218        <Caret Line="335" Column="1" TopLine="322"/>
    202219      </Position10>
    203220      <Position11>
    204         <Filename Value="UMainForm.pas"/>
    205         <Caret Line="134" Column="1" TopLine="126"/>
     221        <Filename Value="UItemListForm.pas"/>
     222        <Caret Line="336" Column="1" TopLine="323"/>
    206223      </Position11>
    207224      <Position12>
    208         <Filename Value="UMainForm.pas"/>
    209         <Caret Line="133" Column="1" TopLine="120"/>
     225        <Filename Value="UItemListForm.pas"/>
     226        <Caret Line="328" Column="1" TopLine="315"/>
    210227      </Position12>
    211228      <Position13>
    212         <Filename Value="UMainForm.pas"/>
    213         <Caret Line="134" Column="1" TopLine="121"/>
     229        <Filename Value="UItemListForm.pas"/>
     230        <Caret Line="329" Column="1" TopLine="316"/>
    214231      </Position13>
    215232      <Position14>
    216         <Filename Value="UMainForm.pas"/>
    217         <Caret Line="205" Column="48" TopLine="191"/>
     233        <Filename Value="UItemListForm.pas"/>
     234        <Caret Line="334" Column="1" TopLine="321"/>
    218235      </Position14>
    219236      <Position15>
    220         <Filename Value="UMainForm.pas"/>
    221         <Caret Line="133" Column="1" TopLine="120"/>
     237        <Filename Value="UItemListForm.pas"/>
     238        <Caret Line="328" Column="1" TopLine="315"/>
    222239      </Position15>
    223240      <Position16>
    224         <Filename Value="UMainForm.pas"/>
    225         <Caret Line="134" Column="1" TopLine="121"/>
     241        <Filename Value="UItemListForm.pas"/>
     242        <Caret Line="329" Column="1" TopLine="316"/>
    226243      </Position16>
    227244      <Position17>
    228         <Filename Value="UMainForm.pas"/>
    229         <Caret Line="204" Column="1" TopLine="191"/>
     245        <Filename Value="UItemListForm.pas"/>
     246        <Caret Line="334" Column="1" TopLine="321"/>
    230247      </Position17>
    231248      <Position18>
    232         <Filename Value="UMainForm.pas"/>
    233         <Caret Line="205" Column="1" TopLine="192"/>
     249        <Filename Value="UItemListForm.pas"/>
     250        <Caret Line="328" Column="1" TopLine="315"/>
    234251      </Position18>
    235252      <Position19>
    236         <Filename Value="UMainForm.pas"/>
    237         <Caret Line="229" Column="9" TopLine="205"/>
     253        <Filename Value="UItemListForm.pas"/>
     254        <Caret Line="329" Column="1" TopLine="316"/>
    238255      </Position19>
    239256      <Position20>
    240         <Filename Value="UMainForm.pas"/>
    241         <Caret Line="230" Column="1" TopLine="214"/>
     257        <Filename Value="UItemListForm.pas"/>
     258        <Caret Line="330" Column="1" TopLine="317"/>
    242259      </Position20>
    243260      <Position21>
    244         <Filename Value="UMainForm.pas"/>
    245         <Caret Line="135" Column="1" TopLine="122"/>
     261        <Filename Value="UItemListForm.pas"/>
     262        <Caret Line="331" Column="1" TopLine="318"/>
    246263      </Position21>
    247264      <Position22>
    248         <Filename Value="UMainForm.pas"/>
    249         <Caret Line="173" Column="1" TopLine="160"/>
     265        <Filename Value="UItemListForm.pas"/>
     266        <Caret Line="332" Column="1" TopLine="319"/>
    250267      </Position22>
    251268      <Position23>
    252         <Filename Value="UMainForm.pas"/>
    253         <Caret Line="174" Column="1" TopLine="161"/>
     269        <Filename Value="UItemListForm.pas"/>
     270        <Caret Line="328" Column="1" TopLine="315"/>
    254271      </Position23>
    255272      <Position24>
    256         <Filename Value="UMainForm.pas"/>
    257         <Caret Line="170" Column="25" TopLine="162"/>
     273        <Filename Value="UItemListForm.pas"/>
     274        <Caret Line="329" Column="1" TopLine="316"/>
    258275      </Position24>
    259276      <Position25>
    260         <Filename Value="UMainForm.pas"/>
    261         <Caret Line="135" Column="14" TopLine="120"/>
     277        <Filename Value="UItemListForm.pas"/>
     278        <Caret Line="334" Column="1" TopLine="321"/>
    262279      </Position25>
    263280      <Position26>
    264         <Filename Value="Translator.lpr"/>
    265         <Caret Line="16" Column="34" TopLine="1"/>
     281        <Filename Value="UItemListForm.pas"/>
     282        <Caret Line="335" Column="1" TopLine="322"/>
    266283      </Position26>
    267284      <Position27>
    268         <Filename Value="Translator.lpr"/>
    269         <Caret Line="19" Column="1" TopLine="1"/>
     285        <Filename Value="UItemListForm.pas"/>
     286        <Caret Line="336" Column="1" TopLine="323"/>
    270287      </Position27>
    271288      <Position28>
    272         <Filename Value="Translator.lpr"/>
    273         <Caret Line="8" Column="30" TopLine="1"/>
     289        <Filename Value="UItemListForm.pas"/>
     290        <Caret Line="328" Column="1" TopLine="315"/>
    274291      </Position28>
    275292      <Position29>
    276         <Filename Value="UMainForm.pas"/>
    277         <Caret Line="104" Column="37" TopLine="44"/>
     293        <Filename Value="UItemListForm.pas"/>
     294        <Caret Line="329" Column="1" TopLine="316"/>
    278295      </Position29>
    279296      <Position30>
    280         <Filename Value="UMainForm.pas"/>
    281         <Caret Line="180" Column="21" TopLine="159"/>
     297        <Filename Value="UItemListForm.pas"/>
     298        <Caret Line="334" Column="1" TopLine="321"/>
    282299      </Position30>
    283300    </JumpHistory>
     
    298315  </CompilerOptions>
    299316  <Debugging>
    300     <BreakPoints Count="1">
     317    <BreakPoints Count="2">
    301318      <Item1>
    302319        <Source Value="..\..\..\..\..\..\Lazarus\lcl\include\customlistview.inc"/>
    303320        <Line Value="518"/>
    304321      </Item1>
     322      <Item2>
     323        <Source Value="UItemListForm.pas"/>
     324        <Line Value="328"/>
     325      </Item2>
    305326    </BreakPoints>
    306327    <Exceptions Count="2">
  • tools/Lazarus translator/Translator.lpr

    r4 r9  
    99  Interfaces, // this includes the LCL widgetset
    1010  Forms
    11   { you can add units after this }, UMainForm, UItemTranslationForm,
    12   UTextFileStream;
     11  { you can add units after this }, UItemListForm, UItemTranslationForm,
     12  UTextFileStream, UMainForm;
    1313
    1414begin
    1515  Application.Initialize;
    1616  Application.CreateForm(TMainForm, MainForm);
     17  Application.CreateForm(TItemListForm, ItemListForm);
    1718  Application.CreateForm(TItemTranslationForm, ItemTranslationForm);
    1819  Application.Run;
  • tools/Lazarus translator/UMainForm.lfm

    r7 r9  
    11object MainForm: TMainForm
    2   Left = 245
    3   Height = 553
    4   Top = 131
    5   Width = 728
    6   Caption = 'Překlad Lazarusu'
    7   ClientHeight = 553
    8   ClientWidth = 728
     2  Left = 271
     3  Height = 483
     4  Top = 168
     5  Width = 658
     6  Caption = 'Seznam překladových souborů'
     7  ClientHeight = 483
     8  ClientWidth = 658
    99  OnCreate = FormCreate
    10   OnDestroy = FormDestroy
    11   OnShow = FormShow
    1210  ParentFont = False
    13   Position = poScreenCenter
    1411  LCLVersion = '0.9.26'
    1512  object ListView1: TListView
    16     Left = 8
    17     Height = 512
     13    Left = 9
     14    Height = 440
    1815    Top = 8
    19     Width = 712
    20     Anchors = [akTop, akLeft, akRight, akBottom]
     16    Width = 632
    2117    Columns = <   
    2218      item
    23         Caption = 'Identifikace'
    24         Width = 200
    25       end   
    26       item
    27         Caption = 'Původní text'
    28         Width = 240
    29       end   
    30       item
    31         Caption = 'Přeložený text'
    32         Width = 240
     19        Caption = 'Název souboru'
     20        Width = 400
    3321      end>
    3422    RowSelect = True
    3523    TabOrder = 0
    3624    ViewStyle = vsReport
    37     OnColumnClick = ListView1ColumnClick
    38     OnCompare = ListView1Compare
    3925    OnDblClick = ListView1DblClick
    40     OnKeyPress = ListView1KeyPress
    4126  end
    42   object ProgressBar1: TProgressBar
    43     Left = 160
    44     Height = 20
    45     Top = 528
    46     Width = 558
    47     Anchors = [akLeft, akRight, akBottom]
    48     Max = 100
     27  object Button1: TButton
     28    Left = 10
     29    Height = 25
     30    Top = 456
     31    Width = 198
     32    Caption = 'Aktualizovat podle anglické verze'
     33    OnClick = Button1Click
    4934    TabOrder = 1
    5035  end
    51   object ComboBox1: TComboBox
    52     Left = 8
    53     Height = 21
    54     Top = 527
    55     Width = 144
    56     ItemHeight = 13
    57     ItemIndex = 0
    58     Items.Strings = (
    59       'lazaruside.cz.po'
    60       'objinspstrconsts.cz.po'
    61       'installerstrconsts.cz.po'
    62       'cgimodules.cz.po'
    63       'codetoolsstrconsts.cz.po'
    64       'h2passtrconsts.cz.po'
    65       'lclstrconsts.cz.po'
    66       'iputils.cz.po'
    67     )
    68     OnChange = ComboBox1Change
    69     Style = csDropDownList
    70     TabOrder = 2
    71     Text = 'lazaruside.cz.po'
    72   end
    7336end
  • tools/Lazarus translator/UMainForm.lrs

    r7 r9  
    1 { This is an automatically generated lazarus resource file }
     1{ Toto je automaticky generovaný zdrojový soubor lazarusu }
    22
    33LazarusResources.Add('TMainForm','FORMDATA',[
    4   'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#245#0#6'Height'#3')'#2#3'Top'#3#131
    5   +#0#5'Width'#3#216#2#7'Caption'#6#17'P'#197#153'eklad Lazarusu'#12'ClientHeig'
    6   +'ht'#3')'#2#11'ClientWidth'#3#216#2#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'
    7   +#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#10'ParentFont'#8#8'Position'#7#14
    8   +'poScreenCenter'#10'LCLVersion'#6#6'0.9.26'#0#9'TListView'#9'ListView1'#4'Le'
    9   +'ft'#2#8#6'Height'#3#0#2#3'Top'#2#8#5'Width'#3#200#2#7'Anchors'#11#5'akTop'#6
    10   +'akLeft'#7'akRight'#8'akBottom'#0#7'Columns'#14#1#7'Caption'#6#12'Identifika'
    11   +'ce'#5'Width'#3#200#0#0#1#7'Caption'#6#14'P'#197#175'vodn'#195#173' text'#5
    12   +'Width'#3#240#0#0#1#7'Caption'#6#17'P'#197#153'elo'#197#190'en'#195#189' tex'
    13   +'t'#5'Width'#3#240#0#0#0#9'RowSelect'#9#8'TabOrder'#2#0#9'ViewStyle'#7#8'vsR'
    14   +'eport'#13'OnColumnClick'#7#20'ListView1ColumnClick'#9'OnCompare'#7#16'ListV'
    15   +'iew1Compare'#10'OnDblClick'#7#17'ListView1DblClick'#10'OnKeyPress'#7#17'Lis'
    16   +'tView1KeyPress'#0#0#12'TProgressBar'#12'ProgressBar1'#4'Left'#3#160#0#6'Hei'
    17   +'ght'#2#20#3'Top'#3#16#2#5'Width'#3'.'#2#7'Anchors'#11#6'akLeft'#7'akRight'#8
    18   +'akBottom'#0#3'Max'#2'd'#8'TabOrder'#2#1#0#0#9'TComboBox'#9'ComboBox1'#4'Lef'
    19   +'t'#2#8#6'Height'#2#21#3'Top'#3#15#2#5'Width'#3#144#0#10'ItemHeight'#2#13#9
    20   +'ItemIndex'#2#0#13'Items.Strings'#1#6#16'lazaruside.cz.po'#6#22'objinspstrco'
    21   +'nsts.cz.po'#6#24'installerstrconsts.cz.po'#6#16'cgimodules.cz.po'#6#24'code'
    22   +'toolsstrconsts.cz.po'#6#20'h2passtrconsts.cz.po'#6#18'lclstrconsts.cz.po'#6
    23   +#13'iputils.cz.po'#0#8'OnChange'#7#15'ComboBox1Change'#5'Style'#7#14'csDropD'
    24   +'ownList'#8'TabOrder'#2#2#4'Text'#6#16'lazaruside.cz.po'#0#0#0
     4  'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#15#1#6'Height'#3#227#1#3'Top'#3#168
     5  +#0#5'Width'#3#146#2#7'Caption'#6#30'Seznam p'#197#153'ekladov'#195#189'ch so'
     6  +'ubor'#197#175#12'ClientHeight'#3#227#1#11'ClientWidth'#3#146#2#8'OnCreate'#7
     7  +#10'FormCreate'#10'ParentFont'#8#10'LCLVersion'#6#6'0.9.26'#0#9'TListView'#9
     8  +'ListView1'#4'Left'#2#9#6'Height'#3#184#1#3'Top'#2#8#5'Width'#3'x'#2#7'Colum'
     9  +'ns'#14#1#7'Caption'#6#14'N'#195#161'zev souboru'#5'Width'#3#144#1#0#0#9'Row'
     10  +'Select'#9#8'TabOrder'#2#0#9'ViewStyle'#7#8'vsReport'#10'OnDblClick'#7#17'Li'
     11  +'stView1DblClick'#0#0#7'TButton'#7'Button1'#4'Left'#2#10#6'Height'#2#25#3'To'
     12  +'p'#3#200#1#5'Width'#3#198#0#7'Caption'#6'"Aktualizovat podle anglick'#195
     13  +#169' verze'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#1#0#0#0
    2514]);
  • tools/Lazarus translator/UMainForm.pas

    r7 r9  
    1 unit UMainForm; 
     1unit UMainForm;
    22
    33{$mode objfpc}{$H+}
     
    77uses
    88  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, UItemTranslationForm, UTextFileStream, StdCtrls;
    10 
    11 const
    12   TranslationFolder: string = '../../trunk/';
    13   TranslationMergeFileName: string = '../../tags/0.9.25/lazaruside.cz.po';
     9  ComCtrls, StdCtrls;
    1410
    1511type
    16   TTranslationItem = class
    17     Identification: string;
    18     OriginalText: string;
    19     TranslatedText: string;
    20   end;
     12
     13  { TForm1 }
    2114
    2215  { TMainForm }
    2316
    2417  TMainForm = class(TForm)
    25     ComboBox1: TComboBox;
     18    Button1: TButton;
    2619    ListView1: TListView;
    27     ProgressBar1: TProgressBar;
    2820    procedure Button1Click(Sender: TObject);
    29     procedure ComboBox1Change(Sender: TObject);
    30     procedure FormShow(Sender: TObject);
    31     procedure FormDestroy(Sender: TObject);
    3221    procedure FormCreate(Sender: TObject);
    33     procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
    34       Data: Integer; var Compare: Integer);
    3522    procedure ListView1DblClick(Sender: TObject);
    36     procedure ListView1KeyPress(Sender: TObject; var Key: Char);
    37     procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
    3823  private
    39     LastFileName: string;
    40     procedure MergeListFromFile;
     24    procedure LoadTranslationList;
     25    { private declarations }
    4126  public
    42     LastSortedColumn: Integer;
    43     StringList: TList; // TList<TText>
    44     procedure FillList;
    45     procedure LoadListFromFile;
    46     procedure SaveListToFile;
    47   end;
     27    { public declarations }
     28  end;
    4829
    4930var
    5031  MainForm: TMainForm;
    51   Ascending: Boolean;
    5232
    5333implementation
    5434
    55 function SortByColumn(Item1, Item2: TListItem; Data: integer): Integer; stdcall;
     35uses
     36  UItemListForm;
     37
     38{ TMainForm }
     39
     40procedure TMainForm.ListView1DblClick(Sender: TObject);
    5641begin
    57   if Data = 0 then
    58     Result := AnsiCompareText(Item1.Caption, Item2.Caption)
    59   else
    60     Result := AnsiCompareText(Item1.SubItems[Data - 1],
    61       Item2.SubItems[Data - 1]);
    62   if not Ascending then Result := -Result;
    63 end;
    64 
    65 procedure TMainForm.FillList;
    66 var
    67   I: Integer;
    68   NewItem: TListItem;
    69   CompletedCount: Integer;
    70 begin
    71   CompletedCount := 0;
    72   with ListView1, Items do begin
    73     BeginUpdate;
    74     Clear;
    75     for I := 0 to StringList.Count - 1 do
    76     with TTranslationItem(StringList[I]) do begin
    77       NewItem := Add;
    78       NewItem.Data := StringList[I];
    79       NewItem.Caption := OriginalText;
    80       with NewItem.SubItems do begin
    81         Add(TranslatedText);
    82         Add(Identification);
    83         if TranslatedText <> '' then Inc(CompletedCount);
    84       end;
     42  if Assigned(ListView1.Selected) then begin
     43    if not FileExists(TranslationFolder + ItemListForm.RenameToLocale(ListView1.Selected.Caption)) then begin
     44      ForceDirectories(TranslationFolder + ExtractFileDir(ListView1.Selected.Caption));
     45      if FileExists(LazarusRepository + ListView1.Selected.Caption) then
     46        FileCopy(LazarusRepository + ListView1.Selected.Caption, TranslationFolder + ItemListForm.RenameToLocale(ListView1.Selected.Caption))
     47          else raise Exception.Create('Zdrojový soubor ' + LazarusRepository + ListView1.Selected.Caption + ' nenalezen!');
    8548    end;
    86     EndUpdate;
     49    ItemListForm.TranslationFile := TranslationFolder + ItemListForm.RenameToLocale(ListView1.Selected.Caption);
     50    ItemListForm.ShowModal;
    8751  end;
    88   ProgressBar1.Max := StringList.Count;
    89   ProgressBar1.Position := CompletedCount;
    9052end;
    9153
    9254procedure TMainForm.FormCreate(Sender: TObject);
    9355begin
    94   StringList := TList.Create;
    95   LastSortedColumn := -1;
    96   Ascending := True;
     56  LoadTranslationList;
    9757end;
    9858
    99 procedure TMainForm.ListView1Compare(Sender: TObject; Item1, Item2: TListItem;
    100   Data: Integer; var Compare: Integer);
    101 begin
    102     Compare := AnsiCompareText(Item1.SubItems[0],
    103       Item2.SubItems[0]);
    104   if not Ascending then Compare := -Compare;
    105 end;
    106 
    107 procedure TMainForm.FormDestroy(Sender: TObject);
     59procedure TMainForm.Button1Click(Sender: TObject);
    10860var
    10961  I: Integer;
    11062begin
    111   SaveListToFile;
    112   for I := 0 to StringList.Count - 1 do
    113     TTranslationItem(StringList[I]).Free;
    114   StringList.Free;
    115 end;
    116 
    117 procedure TMainForm.FormShow(Sender: TObject);
    118 begin
    119   LoadListFromFile;
    120   //MergeListFromFile;
    121   FillList;
    122 end;
    123 
    124 procedure TMainForm.Button1Click(Sender: TObject);
    125 begin
    126   ListView1.SortColumn := 1;
    127   ListView1.SortType := stData;
    128   ListView1.Refresh;
    129   ListView1.Invalidate;
    130 end;
    131 
    132 procedure TMainForm.ComboBox1Change(Sender: TObject);
    133 begin
    134   SaveListToFile;
    135   LoadListFromFile;
    136   FillList;
    137 end;
    138 
    139 procedure TMainForm.ListView1ColumnClick(Sender: TObject; Column: TListColumn);
    140 begin
    141   if Column.Index = LastSortedColumn then
    142     Ascending := not Ascending
    143   else
    144     LastSortedColumn := Column.Index;
    145   //TListView(Sender).CustomSort(@SortByColumn, Column.Index);
    146 end;
    147 
    148 procedure TMainForm.ListView1DblClick(Sender: TObject);
    149 begin
    150   if Assigned(ListView1.Selected) then
    151   with ItemTranslationForm, TTranslationItem(ListView1.Selected.Data) do begin
    152     Memo1.Text := OriginalText;
    153     Memo2.Text := TranslatedText;
    154     ItemTranslationForm.ShowModal;
    155     //OriginalText := Memo1.Text;
    156     TranslatedText := Copy(Memo2.Text, 1, Length(Memo2.Text) - 2);
    157 
    158     ListView1.Selected.SubItems[0] := TranslatedText;
    159     SaveListToFile;
     63  for I := 0 to High(LanguageFiles) do begin
     64    ForceDirectories(TranslationFolder + ExtractFileDir(LanguageFiles[I]));
     65    ItemListForm.TranslationFile := LazarusRepository + LanguageFiles[I];
     66    ItemListForm.LoadListFromFile;
     67    ItemListForm.TranslationFile := TranslationFolder + ItemListForm.RenameToLocale(LanguageFiles[I]);
     68    ItemListForm.MergeListFromFile;
     69    ItemListForm.SaveListToFile;
    16070  end;
    16171end;
    16272
    163 procedure TMainForm.ListView1KeyPress(Sender: TObject; var Key: Char);
     73procedure TMainForm.LoadTranslationList;
     74var
     75  I: Integer;
     76  NewItem: TListItem;
    16477begin
    165   if Key = #13 then ListView1DblClick(Self);
    166 end;
    167 
    168 procedure TMainForm.LoadListFromFile;
    169 var
    170   Source: TTextFileStream;
    171   Row: string;
    172   NewItem: TTranslationItem;
    173   I: Integer;
    174 begin
    175   StringList.Clear;
    176   LastFileName := TranslationFolder + ComboBox1.Text;
    177   NewItem := nil;
    178   Source := TTextFileStream.Create(LastFileName, fmOpenRead);
    179   try
    180     for I := 0 to 11 do Row := Source.ReadLn;  // Skip leading info lines
    181 
    182     while not Source.Eof do begin
    183       Row := Source.ReadLn;
    184       if Copy(Row, 1, 2) = '#:' then begin
    185         NewItem := TTranslationItem.Create;
    186         NewItem.Identification := Copy(Row, 4, 255);
    187       end else
    188       if Copy(Row, 1, Pos(' ', Row) - 1) = 'msgid' then begin
    189         if Assigned(NewItem) then
    190           NewItem.OriginalText := Copy(Row, 8, Length(Row) - 8)
    191       end else
    192       if Copy(Row, 1, Pos(' ', Row) - 1) = 'msgstr' then begin
    193         NewItem.TranslatedText := Copy(Row, 9, Length(Row) - 9);
    194         StringList.Add(NewItem);
    195       end;
    196     end;
    197   finally
    198     Source.Free;
     78  ListView1.Items.Clear;
     79  for I := 0 to High(LanguageFiles) do begin
     80    NewItem := ListView1.Items.Add;
     81    NewItem.Caption := LanguageFiles[I]
    19982  end;
    20083end;
    201 
    202 procedure TMainForm.SaveListToFile;
    203 var
    204   Source: TTextFileStream;
    205   I: Integer;
    206 begin
    207   Source := TTextFileStream.Create(LastFileName, fmOpenWrite);
    208   with Source do
    209   try
    210     WriteLn('msgid ""');
    211     WriteLn('msgstr ""');
    212     WriteLn('"Project-Id-Version: \n"');
    213     WriteLn('"POT-Creation-Date: \n"');
    214     WriteLn('"PO-Revision-Date: 2009-01-07 19:03+0100\n"');
    215     WriteLn('"Last-Translator: Chronos <robie@centrum.cz>\n"');
    216     WriteLn('"Translation-Source: http://tv.zdechov.net/svn/lazarus_czech/\n"');
    217     WriteLn('"Language-Team: \n"');
    218     WriteLn('"MIME-Version: 1.0\n"');
    219     WriteLn('"Content-Type: text/plain; charset=UTF-8\n"');
    220     WriteLn('"Content-Transfer-Encoding: 8bit\n"');
    221     WriteLn('');
    222     for I := 0 to StringList.Count - 1 do
    223     with TTranslationItem(StringList[I]) do begin
    224       WriteLn('#: ' + Identification);
    225       WriteLn('msgid "' + OriginalText + '"');
    226       WriteLn('msgstr "' + TranslatedText + '"');
    227       WriteLn('');
    228     end;
    229   finally
    230     Source.Free;
    231   end;
    232 end;
    233 
    234 procedure TMainForm.MergeListFromFile;
    235 var
    236   Source: TTextFileStream;
    237   Row: string;
    238   NewItem: TTranslationItem;
    239   I: Integer;
    240 begin
    241   NewItem := nil;
    242   Source := TTextFileStream.Create(TranslationMergeFileName, fmOpenRead);
    243   try
    244     for I := 0 to 10 do Row := Source.ReadLn;  // Skip lines
    245 
    246     while not Source.Eof do begin
    247       Row := Source.ReadLn;
    248       if Copy(Row, 1, 2) = '#:' then begin
    249         NewItem := TTranslationItem.Create;
    250         NewItem.Identification := Copy(Row, 4, 255);
    251       end else
    252       if Copy(Row, 1, Pos(' ', Row) - 1) = 'msgid' then
    253         NewItem.OriginalText := Copy(Row, 8, Length(Row) - 8)
    254       else
    255       if Copy(Row, 1, Pos(' ', Row) - 1) = 'msgstr' then begin
    256         NewItem.TranslatedText := Copy(Row, 9, Length(Row) - 9);
    257         I := 0;
    258         while (I < StringList.Count) and ((TTranslationItem(StringList[I]).OriginalText <> NewItem.OriginalText) or
    259         (TTranslationItem(StringList[I]).Identification <> NewItem.Identification)) do Inc(I);
    260         if I < StringList.Count then
    261           TTranslationItem(StringList[I]).TranslatedText := NewItem.TranslatedText;
    262         NewItem.Free;
    263       end;
    264     end;
    265   finally
    266     Source.Free;
    267   end;
    268 end;
    269 
    27084
    27185initialization
Note: See TracChangeset for help on using the changeset viewer.