Saturday, May 7, 2011

Membuat Kamus/Dictionary

By : Zephio
//Bagian Data
unit Data;

interface

Uses
   IniFiles, SysUtils, Forms;

procedure Translate;

var
   Ini : TIniFile;

implementation

procedure Translate;
begin
try
   Ini := TIniFile.Create(ChangeFileExt(Application.ExeName,'.zsd'));
// Jawa - Indonesia
   Ini.WriteString('Zephio Soft - 2010', 'Koen', 'Kamu, Anda');
   Ini.WriteString('Zephio Soft - 2010', 'Aku', 'Saya, Aku');
// Indonesia - Jawa
   Ini.WriteString('Zephio Soft - 2010', 'Saya', 'Aku, Awakku');
   Ini.WriteString('Zephio Soft - 2010', 'Kamu', 'Koen, Kowe, Awakmu, Sampeyan');
 finally
   Ini.Free;
 end;
end;

end.
 
 
//Engine
unit Engine;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls, IniFiles, Data;

type
  TForm1 = class(TForm)
    E1: TEdit;
    M1: TMemo;
    B1: TSpeedButton;
    Label1: TLabel;
    Label2: TLabel;
    E3: TEdit;
    E4: TEdit;
    Label3: TLabel;
    B2: TSpeedButton;
    procedure FormShow(Sender: TObject);
    procedure B1Click(Sender: TObject);
    procedure B2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Ini : TIniFile;
 
implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
begin
if not FileExists(ChangeFileExt(ExtractFileName(Application.ExeName),'.zsd')) then
   Translate;
end;

procedure TForm1.B1Click(Sender: TObject);
begin
if (E1.Text = '') then
   ShowMessage('Input Masih Kosong'+#13#10+'Silahkan Isi Kata yang hendak ditranslate!....')
else
try
   Ini := TIniFile.Create(ChangeFileExt(Application.ExeName,'.zsd'));
   M1.Lines.Text := Ini.ReadString('Zephio Soft - 2010', E1.Text, '');
 finally
   Ini.Free;
 end;
end;

procedure TForm1.B2Click(Sender: TObject);
begin
if (E3.Text = '') or
   (E4.Text = '') then
begin
   ShowMessage('Input Masih Kosong'+#13#10+'Silahkan Isi Kata yang hendak ditambahkan');
   Exit
end
else
   Ini := TIniFile.Create(ChangeFileExt(Application.ExeName,'.zsd'));
   Ini.WriteString('Zephio Soft - 2010', E3.Text, E4.Text);
   Ini.Free;
end;

end.
DL SC : http://www.mediafire.com/?b1r6ggpp77pba2p

No comments:

Post a Comment