Jump to content

Recommended Posts

Ok i know this is definitely possible cause i've seen it somewhere.

 

I created my own fantasy language and i'l show you the demo here:

R=Se r=se

A=Ek a=ek

Y=Tu y=tu

T=Va t=va

H=Me h=me

 

As you see this spells Rayth and output WOULD be Seektuvame.

However, login in this language outputs as Sektuvame so my request is:

How would i replace all the letters and change double vowels to single vowels and output to the user (as in ee to e and oo to o and only for encrypted so wood would still use the double o. also non-vowels which are doubled are not removed)

Link to comment
https://forums.phpfreaks.com/topic/187348-custom-language/
Share on other sites

use count_chars

 

Depending on mode  count_chars() returns one of the following:

 

    * 0 - an array with the byte-value as key and the frequency of every byte as value.

    * 1 - same as 0 but only byte-values with a frequency greater than zero are listed.

    * 2 - same as 0 but only byte-values with a frequency equal to zero are listed.

  * 3 - a string containing all unique characters is returned.

    * 4 - a string containing all not used characters is returned.

 

scratch that... that would just delete the double letters.. but you can still use this function

 

 

 

[ot]

foreach (count_chars($encryptedString, 1) as $i => $letterCount)

    if($letterCount > 1) ......

................. nevermind... that won't work[/ot]

 

for($i=0; $i     if($i>0 && ($encryptedString{$i-1} == $encryptedString{$i}) continue 0;
     else $recryptedString .= $encryptedString{$i};
}

Link to comment
https://forums.phpfreaks.com/topic/187348-custom-language/#findComment-989335
Share on other sites

ok i have the following so far which works perfectly apart from removing doubles:

 

                <script LANGUAGE="JavaScript">

var langArray = new Array();

// *******************************************************************
// English
// *******************************************************************
langArray[0] = new Array();
langArray[0][0]  = "A";
langArray[0][1]  = "B";
langArray[0][2]  = "C";
langArray[0][3]  = "D";
langArray[0][4]  = "E";
langArray[0][5]  = "F";
langArray[0][6]  = "G";
langArray[0][7]  = "H";
langArray[0][8]  = "I";
langArray[0][9]  = "J";
langArray[0][10] = "K";
langArray[0][11] = "L";
langArray[0][12] = "M";
langArray[0][13] = "N";
langArray[0][14] = "O";
langArray[0][15] = "P";
langArray[0][16] = "Q";
langArray[0][17] = "R";
langArray[0][18] = "S";
langArray[0][19] = "T";
langArray[0][20] = "U";
langArray[0][21] = "V";
langArray[0][22] = "W";
langArray[0][23] = "X";
langArray[0][24] = "Y";
langArray[0][25] = "Z";
langArray[0][26]  = "a";
langArray[0][27]  = "b";
langArray[0][28]  = "c";
langArray[0][29]  = "d";
langArray[0][30]  = "e";
langArray[0][34]  = "f";
langArray[0][35]  = "g";
langArray[0][36]  = "h";
langArray[0][37]  = "i";
langArray[0][38]  = "j";
langArray[0][39] = "k";
langArray[0][40] = "l";
langArray[0][41] = "m";
langArray[0][42] = "n";
langArray[0][43] = "o";
langArray[0][44] = "p";
langArray[0][45] = "q";
langArray[0][46] = "r";
langArray[0][47] = "s";
langArray[0][48] = "t";
langArray[0][49] = "u";
langArray[0][50] = "v";
langArray[0][51] = "w";
langArray[0][52] = "x";
langArray[0][53] = "y";
langArray[0][54] = "z";
// *******************************************************************
// Lanugage
// *******************************************************************
langArray[1] = new Array();
langArray[1][0]  = "Ek";
langArray[1][1]  = "De";
langArray[1][2]  = "Ba";
langArray[1][3]  = "Hu";
langArray[1][4]  = "Il";
langArray[1][5]  = "Na";
langArray[1][6]  = "Jo";
langArray[1][7]  = "Me";
langArray[1][8]  = "Oc";
langArray[1][9]  = "Ke";
langArray[1][10] = "Po";
langArray[1][11] = "Gi";
langArray[1][12] = "Fi";
langArray[1][13] = "Le";
langArray[1][14] = "Ur";
langArray[1][15] = "Ru";
langArray[1][16] = "Yi";
langArray[1][17] = "Se";
langArray[1][18] = "Co";
langArray[1][19] = "Va";
langArray[1][20] = "Ar";
langArray[1][21] = "Wa";
langArray[1][22] = "Qi";
langArray[1][23] = "Ze";
langArray[1][24] = "Tu";
langArray[1][25] = "Xi";
langArray[1][26]  = "ek";
langArray[1][27]  = "de";
langArray[1][28]  = "ba";
langArray[1][29]  = "hu";
langArray[1][30]  = "il";
langArray[1][34]  = "na";
langArray[1][35]  = "jo";
langArray[1][36]  = "me";
langArray[1][37]  = "oc";
langArray[1][38]  = "ke";
langArray[1][39] = "po";
langArray[1][40] = "gi";
langArray[1][41] = "fi";
langArray[1][42] = "le";
langArray[1][43] = "ur";
langArray[1][44] = "ru";
langArray[1][45] = "yi";
langArray[1][46] = "se";
langArray[1][47] = "co";
langArray[1][48] = "va";
langArray[1][49] = "ar";
langArray[1][50] = "wa";
langArray[1][51] = "qi";
langArray[1][52] = "ze";
langArray[1][53] = "tu";
langArray[1][54] = "xi";


function cmdCalc_Click(form)
{
    if (form.input.value == 0 || form.input.value.length == 0) 
	{
        alert ("You didn't insert something.");
        form.input.focus(); 
	}
    else
        calc();
}

function calc()

{
first = document.form1.input.value;
firstlength = document.form1.input.value.length;
var myvar = ""
var found=0
var skip=0
var lang1=3;
var lang2=3;



lang1=0
lang2=1




for (Count=0; Count < firstlength; Count++) 
{
letter1=first.substring(Count,Count+1);
if (letter1=="[") 
{
skip=1
found=1
}
if (letter1=="]") 
{
skip=0
found=1
}
if (skip==0)
{
for (Count2=0; Count2 < 55; Count2++) 
{
		if (found==0)
		{
			if (letter1==langArray[lang1][Count2]) 
			{
			myvar+=langArray[lang2][Count2]; 
			found=1;
			}
		}
}
}
if (found==0) myvar+=letter1 ;
found=0
}

document.form1.output.value=myvar;
}

</script>
                <form name="form1">
                  <p align="center">Enter Text:</p><p align="center">
                  <textarea value name="input" type="text" rows="6" cols="60"></textarea><br>
                  Translation:<br>

                  <textarea value name="output" type="text" rows="6" cols="60"></textarea><br>
                  <br>
                  <input value="Translate" name="Translate" type="button" value="Translate" onClick="cmdCalc_Click(this.form)"></p>
                </form>

 

Any ideas on how i can make it remove double vowels?

Link to comment
https://forums.phpfreaks.com/topic/187348-custom-language/#findComment-989357
Share on other sites

Just a question.. Will you be "decoding" your language back to english at any stage?

With your first example "Rayeth" becomes "Seektuvame" but you want it to be "Sektuvame" correct?

 

If this is the case its going to be very hard to pick up those dropped letters to reform the english version...

Link to comment
https://forums.phpfreaks.com/topic/187348-custom-language/#findComment-989368
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.