Click to See Complete Forum and Search --> : Ok khalidali63 here we GOO!!


enigma
02-08-2003, 04:51 AM
OK so i'm going to explain everything one by one . I make a page about RPGs that are made by Squaresoft . And the game title is Final Fanatsy X (that's ten) maybe you now this game ? And in this game there are Al Bhed (no time for explainig) and they speak an other language that can be learned by reading primers that are all over the world , but one primar exaplains you the meaning of one character in the Al Bhed language . And i'm schould make a program that transletes the Al Bhed I made it with the delphi 5.0 but my boss tells me that there schould be a posibility to translate the Al Bhed even on the website and those who want to dowload it schould download my program and i don't know how to make an such java script so i searched and found a script , but i could not find what makes it replace the character and there where thing like this script was dowloaded form this site and theere i found this script
http://javascript.internet.com/forms/replace-characters.html
And i did what they said i it worked "a" was replaced with "z" , but i didn't know how to make more charcters be replaced (that's why i gave this the title how to replace 2 charcters not because i wanted to replace only 2 identycal chracters but not only the "a" with the"z") . I would also like that pressing the button under the text box would not replace the charcters in the same text box but it would place the replaced form in a second text box to the right . And the same with the second text box , pressing the (second) button under the second text box would make the text from the second text box apear in the first text box but in the proper english (reverse replacing or something like that to make the replaced normal again) . So it schould look so (An image would have too much size)

Text box1 Text box 2
Button1 button2

And here is how the characters schould be replaced
Replace 'y' with 'a' Replace 'o' with 'y'
Replace 'u' with 'o' Replace 'i' with 'u'
Replace 'e' with 'i' Replace 'a' with 'e'
Replace 'p' with 'b' Replace 'b' with 'p'
Replace 'l' with 'c' Replace 'm' with 'l'
Replace 's' with 'm' Replace 'c' with 's'
Replace 'v' with 'f' Replace 'j' with 'v'
Replace 'z' with 'j' Replace 'w' with 'z'
Replace 'f' with 'w' Replace 'k' with 'g'
Replace 'g' with 'k' Replace 'r' with 'h'
Replace 'n' with 'r' Replace 'h' with 'n'
Replace 't' with 'd' Replace 'd' with 't'
Replace 'x' with 'q' Replace 'q' with 'x'
Ok and names of locations and persons schould not be replaced so if you could (if it will be too much then forget about it)
This are some words that schould not be replaced only 4 bethe rest i think i'l do alone
Beisaid , Macalania , Al Bhed and summoner
I hope this helps . Tell me if it is not enough for you .

I thank you for forgiving me

Charles
02-08-2003, 06:14 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<style type="text/css">
<!--
form {width:30%; float:left}
-->
</style>
<script type="text/javascript">
<!--
String.prototype.translate = function (s1, s2) {
var a1 = s1.split('');
var a2 = s2.split('');
var o = new Object();
for (i=0; i<a1.length; i++) {o[a1[i]] = a2[i]}
var a = this.split('');
for (i=0; i<a.length; i++) {if (o[a[i]]) a[i] = o[a[i]]};
return a.join('');
}
// -->
</script>
<form action="translate.pl" onsubmit="document.alBhed.alBhedText.value = this.englishText.value.translate('yueplsvzfgntxoiabmcjwkrhdq', 'aoibcmfjwkrdqyueplsvzghntx'); return false" name="english">
<div><label for="englishText">English</label>
<br>
<input type="text" name="englishText">
<br>
<input type="submit"></div>
</form>
<form action="translate.pl" onsubmit="document.english.englishText.value = this.alBhedText.value.translate('aoibcmfjwkrdqyueplsvzghntx', 'yueplsvzfgntxoiabmcjwkrhdq'); return false" name="alBhed">
<div>
<label for="alBhedText">Al Bhed</label><br>
<input type="text" name="alBhedText"><br>
<input type="submit">
</div>
</form>

You'll find that the scripts over at the JavaScript source are really bad. JavaScript has a String method that replaces characters, and oddly enough it's called String.replace (http://developer.netscape.com/docs/manuals/js/client/jsref/string.htm#1194258) If you read the documentation you will see that it a very powerful and useful method. But you cannot use it here. Here you must make sure that once you have replaced a character in a String you do not replace it again. And because one in ten users do not use JavaScript, be sure to write a server side script that the forms can call when they need to.

khalidali63
02-08-2003, 08:49 AM
Thanks for saying food stuff

:D

Now let me know if you still any more need on this.Since charles solution above is prety neat and it seems to take care of your problem.

cheers

Khalid