Jump to content

Oníṣe:Moyogo/Converter.html

Lát'ọwọ́ Wikipedia, ìwé ìmọ̀ ọ̀fẹ́

HTML page with Javascript converting between Yoruba Nigeria spelling and Yoruba Benin spelling. Copy and paste in a new HTML file (create new text file and name Converter.html), open with browser for testing.


<html> 

<head> 

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 

<!-- d --> 

<title>Yoruba Nigeria - Yoruba Benin converter</title> 

<meta name="description" content="Yoruba Nigeria - Yoruba Benin converter" /> 

<meta http-equiv="Content-Language" content="en"> 

<!-- d --> 

		<script type="text/javascript">
// Derivative of converters of http://www.transliteration.kpr.eu/ but for Yoruba Nigeria <-> Yoruba Benin
// Same license:
// All our converters are released into the public domain. We grant anyone the right to use the source code of our converters for free for any purpose, without any conditions. We are glad if you report mistakes in our converter or provide improved version of it.

var translit;



function yongyobj () {

translit = document.transcription.text1.value;
/// Normalize first ///
// NFC to NFD, ex: e_dot_below -> e + dot_below
translit = translit.replace(/ẹ/g, "e\u0323");
translit = translit.replace(/ọ/g, "o\u0323");
translit = translit.replace(/ṣ/g, "s\u0323");
translit = translit.replace(/Ẹ/g, "E\u0323");
translit = translit.replace(/Ọ/g, "O\u0323");
translit = translit.replace(/Ṣ/g, "S\u0323");
// others to NFD, ex: a_acute -> a + acute
translit = translit.replace(/á/g, "a\u0301");
translit = translit.replace(/à/g, "a\u0300");
translit = translit.replace(/ā/g, "a\u0304");
translit = translit.replace(/â/g, "a\u0302");
translit = translit.replace(/ǎ/g, "a\u030C");
translit = translit.replace(/é/g, "e\u0301");
translit = translit.replace(/è/g, "e\u0300");
translit = translit.replace(/ē/g, "e\u0304");
translit = translit.replace(/ê/g, "e\u0302");
translit = translit.replace(/ě/g, "e\u030C");
translit = translit.replace(/í/g, "i\u0301");
translit = translit.replace(/ì/g, "i\u0300");
translit = translit.replace(/ī/g, "i\u0304");
translit = translit.replace(/î/g, "i\u0302");
translit = translit.replace(/ǐ/g, "i\u030C");
translit = translit.replace(/ó/g, "o\u0301");
translit = translit.replace(/ò/g, "o\u0300");
translit = translit.replace(/ō/g, "o\u0304");
translit = translit.replace(/ô/g, "o\u0302");
translit = translit.replace(/ǒ/g, "o\u030C");
translit = translit.replace(/ú/g, "u\u0301");
translit = translit.replace(/ù/g, "u\u0300");
translit = translit.replace(/ū/g, "u\u0304");
translit = translit.replace(/û/g, "u\u0302");
translit = translit.replace(/ǔ/g, "u\u030C");
translit = translit.replace(/Á/g, "A\u0301");
translit = translit.replace(/À/g, "A\u0300");
translit = translit.replace(/Ā/g, "A\u0304");
translit = translit.replace(/Â/g, "A\u0302");
translit = translit.replace(/Ǎ/g, "A\u030C");
translit = translit.replace(/É/g, "E\u0301");
translit = translit.replace(/È/g, "E\u0300");
translit = translit.replace(/Ē/g, "E\u0304");
translit = translit.replace(/Ê/g, "E\u0302");
translit = translit.replace(/Ě/g, "E\u030C");
translit = translit.replace(/Í/g, "I\u0301");
translit = translit.replace(/Ì/g, "I\u0300");
translit = translit.replace(/Ī/g, "I\u0304");
translit = translit.replace(/Î/g, "I\u0302");
translit = translit.replace(/Ǐ/g, "I\u030C");
translit = translit.replace(/Ó/g, "O\u0301");
translit = translit.replace(/Ò/g, "O\u0300");
translit = translit.replace(/Ō/g, "O\u0304");
translit = translit.replace(/Ô/g, "O\u0302");
translit = translit.replace(/Ǒ/g, "O\u030C");
translit = translit.replace(/Ú/g, "U\u0301");
translit = translit.replace(/Ù/g, "U\u0300");
translit = translit.replace(/Ū/g, "U\u0304");
translit = translit.replace(/Û/g, "U\u0302");
translit = translit.replace(/Ǔ/g, "U\u030C");

// decomposed non normalized to NFD
// ex: e + accent + dot_below -> e + dot_below + accent
translit = translit.replace(/ẹ́/g, "e\u0323\u0301");

translit = translit.replace(/ẹ̀/g, "e\u0323\u0300");
translit = translit.replace(/ẹ̄/g, "e\u0323\u0304");
translit = translit.replace(/ệ/g, "e\u0323\u0302");
translit = translit.replace(/ẹ̌/g, "e\u0323\u030C");
translit = translit.replace(/ọ́/g, "o\u0323\u0301");
translit = translit.replace(/ọ̀/g, "o\u0323\u0300");
translit = translit.replace(/ọ̄/g, "o\u0323\u0304");
translit = translit.replace(/ộ/g, "o\u0323\u0302");
translit = translit.replace(/̣̌/g, "o\u0323\u030C");
translit = translit.replace(/Ẹ́/g, "E\u0323\u0301");

translit = translit.replace(/Ẹ̀/g, "E\u0323\u0300");
translit = translit.replace(/Ẹ̄/g, "E\u0323\u0304");
translit = translit.replace(/Ệ/g, "E\u0323\u0302");
translit = translit.replace(/Ẹ̌/g, "E\u0323\u030C");
translit = translit.replace(/Ọ́/g, "O\u0323\u0301");
translit = translit.replace(/Ọ̀/g, "O\u0323\u0300");
translit = translit.replace(/Ọ̄/g, "O\u0323\u0304");
translit = translit.replace(/Ộ/g, "O\u0323\u0302");
translit = translit.replace(/Ọ̌/g, "O\u0323\u030C");

/// Titlecase for CV syllable ///
//NFD
translit = translit.replace(/Ṣa/g, "Sha");
translit = translit.replace(/Ṣe/g, "She");
translit = translit.replace(/Ṣi/g, "Shi");
translit = translit.replace(/Ṣo/g, "Sho");
translit = translit.replace(/Ṣu/g, "Shu");

/// Lowercase ///

// NFD ex: e + dot_below + accent

translit = translit.replace(/ẹ/g, "ɛ");

translit = translit.replace(/ọ/g, "ɔ");

translit = translit.replace(/ṣ/g, "sh");

/// Uppercase ///

// NFD

translit = translit.replace(/Ẹ/g, "Ɛ");

translit = translit.replace(/Ọ/g, "Ɔ");

translit = translit.replace(/Ṣ/g, "SH");



document.transcription.text2.value = translit;

}



function yobjyong () {

translit = document.transcription.text2.value;

translit = translit.replace(/ɛ/g, "ẹ");

translit = translit.replace(/ɔ/g, "ọ");

translit = translit.replace(/sh/g, "ṣ");


translit = translit.replace(/Sh/g, "Ṣ");


translit = translit.replace(/Ɛ/g, "Ẹ");

translit = translit.replace(/Ɔ/g, "Ọ");

translit = translit.replace(/SH/g, "Ṣ");

// Keeping everything in NFD


document.transcription.text1.value = translit;

}



function copy1()

{ textRange=document.transcription.text1.createTextRange();

textRange.execCommand("Copy");

textRange="";

}

function copy2()

{ textRange=document.transcription.text2.createTextRange();

textRange.execCommand("Copy");

textRange="";

}
		</script>

		<style type="text/css"> 

		textarea {

			width: 500px;

			height: 300px;

		}

		</style> 

</head> 

<body> 

	<h1>Yoruba Nigeria - Yoruba Benin converter</h1> 





<div align="center"> Type or copy a text:<br> 

  <form name=transcription> 

	<table width=90%><tr align=center> 

		<td> in Yoruba Nigeria alphabet (with Ẹ ẹ Ọ ọ Ṣ ṣ): <br> 

	<textarea name="text1" onKeyUp="yongyobj()"></textarea> 

		  <br> 

		  <br> 

	<input type=button onClick="transcription.text1.select();copy1()" value="copy" class=bf>     

	<input type=button onClick="reset();transcription.text1.focus()"  value="clear" class=bf> 

		</td> 

		<td> here you get it in Yoruba Benin alphabet (Ɛ ɛ Ɔ ɔ Sh sh):<br> 

	<textarea name="text2" onKeyUp="yobjyong()"></textarea> 

			  <br> 

		  <br> 

	<input type=button onClick="transcription.text2.select();copy2()" value="copy" class=bf>     

	<input type=button onClick="reset();transcription.text2.focus()"  value="clear" class=bf> 

	</td></tr></table> 

</form> 



 

<p> </p> 

 

<hr align="left" color="teal"> 

 

<table border="0" width="100%"> 

  <tr> 

    <td width="60%"><font size="1"><a href="http://www.kpr.eu/en/copyright/">Copyright</a> © <a 

    href="http://www.kpr.eu">KPR - Gardeners Club Slovakia</a>, 1998-2010<br>
    Copyright © Denis Moyogo Jacquerye, 2011<br>

    Last changed: 22 December 2011</font></td> 

    <td width="20%" align="center"></td> 

    <td width="20%" align="center"><a href="http://fr.wikipedia.org/w/wiki.phtml?title=User_Talk:Moyogo&action=edit&section=new"><font size="1">Report mistake</font></a></td> 

  </tr> 

</table> 

</body> 

</html>