| View previous topic :: View next topic |
| Author |
Message |
hongthu Member
Joined: 28 Apr 2005 Posts: 4
|
Posted: 28/04/05 12:57 Post subject: Help me! |
|
|
| Have You source code of delphi for The change one langue to second langue program (ex: change english to france). Help me! Thanks. |
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 90 Location: Belgium, Antwerp
|
Posted: 28/04/05 14:01 Post subject: |
|
|
Hi,
Try searching the Delphi help for:
"Internationalizing applications".
That explains exactly how to accomplish this.
Stefan |
|
| Back to top |
|
 |
hongthu Member
Joined: 28 Apr 2005 Posts: 4
|
Posted: 28/04/05 16:17 Post subject: Thank Stefan |
|
|
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! |
|
| Back to top |
|
 |
Radagast Member
Joined: 01 May 2005 Posts: 17 Location: Poland
|
Posted: 01/05/05 21:40 Post subject: |
|
|
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 ) |
|
| Back to top |
|
 |
hongthu Member
Joined: 28 Apr 2005 Posts: 4
|
Posted: 07/05/05 10:59 Post subject: Thank you! |
|
|
| 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. |
|
| Back to top |
|
 |
Radagast Member
Joined: 01 May 2005 Posts: 17 Location: Poland
|
Posted: 07/05/05 11:21 Post subject: |
|
|
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. |
|
| Back to top |
|
 |
hongthu Member
Joined: 28 Apr 2005 Posts: 4
|
Posted: 13/05/05 06:38 Post subject: Help me! |
|
|
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. |
|
| Back to top |
|
 |
Radagast Member
Joined: 01 May 2005 Posts: 17 Location: Poland
|
Posted: 03/06/05 06:36 Post subject: |
|
|
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: | 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. |
|
| Back to top |
|
 |
|