Help me!

Please discuss general Delphi programming topics here.

Help me!

Postby hongthu » April 28th, 2005, 12:57 pm

Have You source code of delphi for The change one langue to second langue program (ex: change english to france). Help me! Thanks. :idea:
hongthu
Member
Member
 
Posts: 4
Joined: April 28th, 2005, 12:41 pm

Postby Stefan » April 28th, 2005, 2:01 pm

Hi,

Try searching the Delphi help for:
"Internationalizing applications".

That explains exactly how to accomplish this.

Stefan
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Thank Stefan

Postby hongthu » April 28th, 2005, 4:17 pm

Thanks!
I'm Vietnamese and speak English not good so I hope You show it to me! if I was wrong.
Stefan dear! I want to write program change text (The document type *.txt, *.doc, ex English to French) for Delphi. Can You show source code for me!
hongthu
Member
Member
 
Posts: 4
Joined: April 28th, 2005, 12:41 pm

Postby Radagast » May 1st, 2005, 9:40 pm

You mean you want to write context translator? I think it's not easy. My idea is:
1. Build database of all words with part of speach specificated.
2. Try to write all possible sentence constructions (I think in English it's quite possible, but I don't know how it is in French or Vietnamese).
3. Write a parser that will recognize sentence construction, find apropriate construction in the other languge, and then translate all the words.
It's easier to say than do, so I can only wish you good luck.
PS. I saw program translating from English to Polish and it was very poor (didn't see the difference beetwen spending time and spending money :) )
Radagast
Active Member
Active Member
 
Posts: 24
Joined: May 1st, 2005, 9:32 pm
Location: Poland

Thank you!

Postby hongthu » May 7th, 2005, 10:59 am

Thank you about your counsel for me! The truth was very difficult but i'm trying, when have good result I will an inform to you. Thank you very much.
hongthu
Member
Member
 
Posts: 4
Joined: April 28th, 2005, 12:41 pm

Postby Radagast » May 7th, 2005, 11:21 am

You're welcome. I'd like to know whether my idea was right. I think you could post your problems here, so we would learn something new.
As your project is quite ambitious I wish you good luck and look forward to some news.
Radagast
Active Member
Active Member
 
Posts: 24
Joined: May 1st, 2005, 9:32 pm
Location: Poland

Help me!

Postby hongthu » May 13th, 2005, 6:38 am

Can you help me!
I have source code for Visual Basic as following:
====================================
Dim vn_words(1 To 1000)
Dim en_words(1 To 1000)
Dim dotime As String
Dim strings As String
Dim check_verbs As Integer
Dim check_pharses As Integer
Dim englishwo, vietnamwo
---------------------------------------------------------------
Private Sub Form_Load()
Form1.Show
t_1.Enabled = False
t_2.Enabled = True
listwords = 1

Open (App.Path & "\pharses.txt") For Input As #1
Do While Not EOF(1)
Input #1, englishwo, vietnamwo
en_words(listwords) = englishwo
vn_words(listwords) = vietnamwo
listwords = listwords + 1
Loop
Close #1
check_pharses = listwords

Open (App.Path & "\verbs.txt") For Input As #1
Do While Not EOF(1)
Input #1, englishwo, vietnamwo
en_words(listwords) = englishwo
vn_words(listwords) = vietnamwo
listwords = listwords + 1
Loop
Close #1
check_verbs = listwords - check_pharses

Open (App.Path & "\words.txt") For Input As #1
Do While Not EOF(1)
Input #1, englishwo, vietnamwo
en_words(listwords) = englishwo
vn_words(listwords) = vietnamwo
listwords = listwords + 1
Loop
Close #1

End Sub

---------------------------------------------------------------------
Private Sub t_1_Timer()
If txtvietnam.Text = "" Then Exit Sub
If dotime = txtvietnam.Text Then Exit Sub
txtenglish.Text = ""
whereareweat = 1
dotime = txtvietnam.Text
strings = txtvietnam.Text
For i = 1 To 13
strings = Replace(strings, vn_words(i), en_words(i) & " ")
Next i
For i = 1 To 1000
strings = Replace(strings, vn_words(i), en_words(i) & " ")
Next i
txtvietnam.Text = strings
End Sub
---------------------------------------------------------------
Private Sub t_2_Timer()
If txtenglish.Text = "" Then Exit Sub
If dotime = txtenglish.Text Then Exit Sub
txtvietnam.Text = ""
whereareweat = 1
dotime = txtenglish.Text
strings = txtenglish.Text
For i = 1 To check_pharses
strings = Replace(strings, vn_words(i), en_words(i) & " ")
Next i
For i = check_pharses To check_verbs
strings = Replace(strings, vn_words(i), en_words(i) & " ")
Next i
For i = 1 To 1000
strings = Replace(strings, en_words(i), vn_words(i) & " ")
Next i
txtvietnam.Text = strings
End Sub
===============================================

But I'm not good Visual Basic Language, Can you show me source code for Delphi the same.
hongthu
Member
Member
 
Posts: 4
Joined: April 28th, 2005, 12:41 pm

Postby Radagast » June 3rd, 2005, 6:36 am

I'm not good at VisualBasic either (if I were I would be at VBArea.com :D ) but as nobody else replies I'll try. I'm half guessing so don't expect much result. Here comes my proposition of code:
Code: Select all
var
vn_words, en_words: array [1..1000] of String; (???)
dotime, strings: String;
check_verbs, check_pharses: integer;
englishwo, vietnamwo: string;

Procedure Form1.OnCreate;
begin
 Timer1.Enabled:=false;
 Timer2.Enabled:=true;
 listwords:=1;

 AssignFile(In1,Application.Path+'\pharses.txt');
 Reset(In1);
 While not eof(In1) do
  begin
   readln(en_words[listwords], vn_words[listwords]); {I've shorten it a bit, but it should still be the same}
   inc(listwords);
  end;
 CloseFile(In1);
 Check_pharses:=listwords;

 AssignFile(In1,Application.Path+'\verbs.txt');
 Reset(In1);
 While not eof(In1) do
  begin
   readln(en_words[listwords], vn_words[listwords]); {I've shorten it a bit, but it should still be the same}
   inc(listwords);
  end;
 CloseFile(In1);
 Check_verbs:=listwords-check_pharses;

 AssignFile(In1,Application.Path+'\words.txt');
 Reset(In1);
 While not eof(In1) do
  begin
   readln(en_words[listwords], vn_words[listwords]); {I've shorten it a bit, but it should still be the same}
   inc(listwords);
  end;
 CloseFile(In1);

end;


procedure Timer1.OnTimer;
begin
If txtvietnam.Text='' then exit;
if dotime=txtvietnam.Text then exit;
txtenglish.Text:='';
whereareweat:=1;
dotime:=txtvietnam.text;
strings:=txtvietnam.text;
for i:= 1 to 13 do
strings:=Replace(strings,vn_words[i],enwords[i] and ');
for i:=1 to 1000 do
strings:=Replace(strings,vn_words[i],enwords[i] and ');
txtvietnam.text:=strings;
end;

Timer2.OneTimer;
//identycznie jak Timer1, tylko trzeba zamienić miejscami English i Vietnam

As I already told you I'm not sure whether it works or not. And I don't know what "Replace" function is, so it may not compile. If so we may try to write it, but I still don't know wheter it works. Could you attach here compiled and working version of this program?
Hope it will be useful.
Radagast
Active Member
Active Member
 
Posts: 24
Joined: May 1st, 2005, 9:32 pm
Location: Poland


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 15 guests

cron