English to Finnish String Replace Problem
Posted: Sun Dec 28, 2008 10:21 pm
Hello, i am making a English to Finnish compiler. But now i have problem in this.
In lang file are:
I want those to:
But code changes that lang words to this:
So how i can do that right? In source are:
In lang file are:
Code: Select all
test
Call
out
Code: Select all
testi
kutsu
ulos
Code: Select all
testi
testi
kutsu
kutsu
ulos
Code: Select all
Dim string.s(99)
Macro Instr(Begin,OriginalString,StringToFind)
FindString(OriginalString,StringToFind,Begin)
EndMacro
Procedure.s GetWord(_Stri$,Which,Separator$)
For Iterator = 1 To Len(_Stri$)
ConStri$ = ConStri$ + Mid(_Stri$,Iterator,1)
If InStr(1,ConStri$,Separator$)
Count = Count + 1
If Count = Which
ProcedureReturn Left(ConStri$,Len(ConStri$)-1)
EndIf
ConStri$ = ""
EndIf
Next Iterator
ProcedureReturn ConStri$
EndProcedure
If ReadFile(0,"file.Lang")
i = 0
While Eof(0) = 0
s$ = Trim(ReadString(0)) + " "
com$ = GetWord(s$, 1," ")
s$ = Right(s$, Len(s$) - Len(com$) - 1)
Select LCase(com$)
Case "console"
s2$ = "konsoli"
Case "hi"
s2$ = "terve"
Case "wait"
s2$ = "odota"
Case "end"
s2$ = "loppu"
Case "Finland"
s2$ = "Suomi"
Case "title"
s2$ = "Otsikko"
Case "test"
s2$ = "testi"
Case "call"
s2$ = "kutsu"
Case "out"
s2$ = "ulos"
EndSelect
string.s(i) = s2$ + " " + s$
i + 1
Wend
CloseFile(0)
for i = 0 to 15
debug string.s(i)
next
Endif