Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-26-2012, 02:05 AM   PM User | #1
SouperAsylum
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
SouperAsylum is an unknown quantity at this point
Can someone help me with this language translator?

I've been trying to make this language translator for a language i've been creating for a story. I got the base code online from someone else's translator and I can't figure out why it's making up it's own words every once in a while even though I have that word specifically in the code. like I have "water" in there as "retwa" and it comes up as "wstayer" and I don't know why. Sorry that there are so many words in there, but i think it plays into my problem. Here's the code:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ideenian Translator</title>
<p><H2><center><font color="#8306CC" face="Freestyle Script" size="20">
Ideenian Translator</center></H2></p>
</br>

<p><font color="D9270F" face="Gabriola" size="7">
<center>
<script type="text/javascript">
var wordPairs = [

["a", "sa"],
["agree", "disenro"],
["air", "anim"],
["all", "lal"],
["allow", "wolit"],
["also", "aka"],
["am", "wa"],
["and", "nec"],
["angry", "grapy"],
["animal", "nanan"],
["answer", "quoner"],
["apple", "plepa"],
["are", "sonar"],
["aside", "dina"],
["ask ", "peto"],
["at", "tay"],
["ate", "te"],
["away", "yawan"],
["band", "nabna"],
["bath", "thab"],
["bathe", "thabay"],
["be ", "eb"],
["become", "motus"],
["bed", "cubal"],
["bee ", "eeb"],
["begin", "incepto"],
["believe", "putov"],
["belt", "blehteh"],
["best", "bonta"],
["book", "bok"],
["borrow", "rotumu"],
["box", "blan"],
["break", "erf"],
["breath", "santin"],
["bring", "rinto"],
["brother", "soha"],
["but", "et"],
["buy", "chay"],
["can", "nac"],
["carry", "ray"],
["change ", "jetio"],
["cold", "doona"],
["color", "roloc"],
["come", "mec"],
["come", "meco"],
["cool", "looin"],
["correct", "rotsek"],
["crazy", "zycra"],
["creature", "turan"],
["creepy", "peecyr"],
["crystal ", "katyr"],
["day", "yad"],
["death", "thead"],
["do", "odi"],
["dress", "dreeah"],
["dry", "dren"],
["earth", "lethra"],
["eat", "ta"],
["egg", "geh"],
["eight", "tet"],
["end", "nedn"],
["evil", "mwaha"],
["father", "dira"],
["feel", "tago"],
["fine", "nifa"],
["fire", "rifelin"],
["fish", "shif"],
["five", "vif"],
["fix", "ify"],
["flower", "reflow"],
["food", "odof"],
["for", "ga"],
["four", "rof"],
["fresh", "shefeh"],
["Friday", "dirfy"],
["friend ", "nolaf"],
["from", "ab"],
["go", "ogg"],
["good", "dool"],
["goodbye", "tasen/tas/en"],
["grass", "snaf"],
["happy", "peeha"],
["hat", "tah"],
["hate", "tahee"],
["have", "vah"],
["he", "eh"],
["heal", "leah"],
["hear", "reah"],
["hello", "tasai/tas/ai"],
["here", "reh"],
["his", "sih"],
["hot", "toen"],
["house", "sohs"],
["how", "woni"],
["hungry ", "nuhryg"],
["I", "ni"],
["in", "nis"],
["is", "si"],
["it", "jina"],
["job", "obij"],
["just", "stuj"],
["know", "peco"],
["lay", "yali"],
["leaf", "flekin"],
["life", "tiva"],
["light", "gith"],
["like", "keyan"],
["little", "tili"],
["look", "okol"],
["loopy", "pyloo"],
["lot", "tolin"],
["love", "lolam"],
["Me", "mah"],
["Monday", "donmy"],
["moon", "noom"],
["morning", "minorg"],
["mother", "diha"],
["Myself", "glof"],
["nature", "renta"],
["my", "ni"],
["night", "tinta"],
["nine", "nin"],
["no", "na"],
["not", "dah"],
["of", "fon"],
["ok", "kona"],
["on", "la"],
["one", "na"],
["or", "vel"],
["our", "ro"],
["out", "tu"],
["pants", "saytah"],
["plant", "tanlep"],
["power", "repo"],
["pretty", "typra"],
["pull", "teef"],
["pyrimid", "primy"],
["right", "nogra"],
["royalty", "lortai"],
["sad", "dashinga"],
["same", "nill"],
["Saturday", "dusty"],
["say", "oros"],
["school", "skol"],
["seven", "vensa"],
["she", "esh"],
["shirt", "showana"],
["shorts", "showta"],
["sick", "keena"],
["silly", "silin"],
["sister", "soma"],
["six", "ix"],
["skirt", "skowana"],
["smell", "lesh"],
["so", "nas"],
["song ", "sara"],
["sorry", "trislus/tris"],
["start", "sar"],
["sun", "nus"],
["Sunday", "dunsy"],
["thankful", "nemus"],
["thankyou", "nemoy/nem"],
["the", "eth"],
["there", "rethe"],
["this", "ith"],
["three", "ret"],
["through", "ruh"],
["throw", "wot"],
["Thursday", "dusthy"],
["to", "ot/oto"],
["toward", " ervas"],
["true ", "resai"],
["Tuesday", "desty"],
["two", "twon"],
["until", "ad"],
["up", "puin"],
["very", "revy"],
["warm", "mar"],
["was", "aws"],
["Water", "retwa"],
["Wednesday", "denwy"],
["wet", "tweh"],
["when", "lin"],
["with", "nai"],
["word", "darin"],
["would", "delow"],
["write", "aiter"],
["yes", "weys"],
["you", "oy"],
["your", "ory"],
["zero", "roz"],
["call", "vor"],



];

var textInput;
var str;
var direction;

function checkText(str)
{
	str = document.getElementById('txtIn').value.toLowerCase();
	direction = document.getElementById('directionSelect').selectedIndex;
	if(direction==0)
	{
		for(i=0; i < wordPairs.length; i++)
		{
			str = str.replace(wordPairs[i][0],wordPairs[i][1]);
		}
	}
	else
	{
		for(i=0; i < wordPairs.length; i++)
		{
			str = str.replace(wordPairs[i][1],wordPairs[i][0]);
		}
	}
	
	document.getElementById('result').innerHTML = str;
	
}


window.onload=function()
{
	document.getElementById('convertBtn').onclick=checkText;
}
</script>
<body background="Magic Forest.jpg">
<input type="text" id="txtIn" />
<button id="convertBtn">Translate</button>
<select id="directionSelect">
<option>English to Ideenian</option>
<option>Ideenian to English</option>
</select>
<div id="result"></div> 
</center></p>
</body>
</html>

Last edited by SouperAsylum; 12-26-2012 at 04:21 AM..
SouperAsylum is offline   Reply With Quote
Reply

Bookmarks

Tags
custom, language, translator

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:07 AM.


Advertisement
Log in to turn off these ads.