PDA

View Full Version : Translation


ratu
Apr 22, 2008, 11:30 AM
The ques is, I have to translate a sentence into french and german.
the followings are been stored in a text file

yes, oui, ja
ism, est, ist
.
.
.and the list goes on.

I try to code this.

Do Until File.Peek = -1

Rec = File.ReadLine
translate = Rec.Split(", ")

If translate(0) = txtEnglish.Text Then
lblFrench.Text = "French translation : " & translate(1)
lblGerman.Text = "German translation : " & translate(2)
End If

Loop

but I can only detect one word translation.
If I keyed in Yes
French Translation : oui
German Translation : ja

The ques want me to allow sentences to be translated. How can I improve my coding?
Someone help me. :(

melondotnet
Apr 28, 2008, 12:24 PM
You will need to loop through individual words, which should be easy with the .spilt method.

I am assuming something rather like this:

Words = txtEnglish.Text.Split(" ")

Now loop through each word, with your current loop inside.

Do.. 'Word Loop

Do... 'Translation Loop

Loop

Loop