Hi I'm new

Hi I’m new. I would like to know how to make a simple translation program. I made up a launguage for my d&d chacter and I would like to know how to make apple script translate english directly into this language. It would need to be able to search the input for words and then put them in order of what I want to say.

For a example purposes can you make a program that translates “Hello world” to “Hi puffy” please and thank you.

Also can anyone suggest a good place to look this stuff up? I also want to be able to change the size of the input box and have it run a spell check and alert me to errors. Im sure there’s a guide out there for this stuff but I can’t find it.

Hi puffy,

a translation program is actually nothing else than two lists of expressions,
then parse one, get the index number and read the corresonding expression from the other list.

a very very simple example is:

property english : {"dog", "cat", "house"}
property german : {"hund", "katze", "haus"}

set t to text returned of (display dialog "enter english word" default answer "")
if t is not in english then display dialog t & " is not in the dictionary" buttons {"Cancel"} default button 1
repeat with i from 1 to count english
	if t is item i of english then exit repeat
end repeat
display dialog "english: " & item i of english & return & "deutsch: " & item i of german

For routines to parse a long list (which can cause timing problems) look into this thread

Yes that works however I would like to know how to get it to pick out words in a sentance rather than 1 word at a time. For instance you put in the sentance “My cat is in my house” and the program spits out

English: My cat is in my house
German: Meine Katze ist in meinem Haus

If the sentences are standard you could follow Stefan’s example but instead of using single words you could use sentences. However, if the sentences are variable, it is much more difficult since the translation has to interpret the grammatical syntax which would require some prety hefty programming.

A simple way that seems to work but not checking grammar is:

property english : {{"dog", "hund"}, {"cat", "katze"}, {"house", "haus"}, {"licked", "geleckt"}, {"sat", "gesessen"}, {"on", "auf"}}

set word_string to ""
set T to text returned of (display dialog "enter english word" default answer "")
--if T is not in english then display dialog T & " is not in the dictionary" buttons {"Cancel"} default button 1
repeat with i from 1 to count of words in T
	set Tword to word i of T
	repeat with ii from 1 to count english
		if Tword is item 1 of item ii of english then
			set word_string to word_string & item 2 of item ii of english & space
			exit repeat
		end if
	end repeat
end repeat
display dialog "english: " & T & return & "deutsch: " & word_string

Perfect thank you!