Help me!

Posted:
April 28th, 2005, 12:57 pm
by hongthu
Have You source code of delphi for The change one langue to second langue program (ex: change english to france). Help me! Thanks.


Posted:
April 28th, 2005, 2:01 pm
by Stefan
Hi,
Try searching the Delphi help for:
"Internationalizing applications".
That explains exactly how to accomplish this.
Stefan
Thank Stefan

Posted:
April 28th, 2005, 4:17 pm
by hongthu
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!

Posted:
May 1st, 2005, 9:40 pm
by Radagast
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

)
Thank you!

Posted:
May 7th, 2005, 10:59 am
by hongthu
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.

Posted:
May 7th, 2005, 11:21 am
by Radagast
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.
Help me!

Posted:
May 13th, 2005, 6:38 am
by hongthu
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.

Posted:
June 3rd, 2005, 6:36 am
by Radagast
I'm not good at VisualBasic either (if I were I would be at VBArea.com

) 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.