Skip to content

Instantly share code, notes, and snippets.

@karimkhanp
Created July 3, 2014 02:54
Show Gist options
  • Save karimkhanp/d4ac41fa864fd8ae0521 to your computer and use it in GitHub Desktop.
Save karimkhanp/d4ac41fa864fd8ae0521 to your computer and use it in GitHub Desktop.
arabic to english convertion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Arabic-English Transliteration</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript"></script>
</head>
<body>
<div class="Paragraph">
<?php
/**
* Example of Arabic-English Transliteration
*
* @category I18N
* @package I18N_Arabic
* @author Khaled Al-Sham'aa <khaled@ar-php.org>
* @copyright 2006-2013 Khaled Al-Sham'aa
*
* @license LGPL <http://www.gnu.org/licenses/lgpl.txt>
* @link http://www.ar-php.org
*/
error_reporting(E_STRICT);
$time_start = microtime(true);
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Transliteration');
$ar_terms = array('خالِد الشَمعَة', 'جُبران خَليل جُبران', 'كاظِم الساهِر',
'ماجِدَة الرُومِي، نِزار قَبَّانِي', 'سُوق الحَمِيدِيَّة؟', 'مَغارَة
جَعِيتَا', 'غُوطَة دِمَشق', 'حَلَب الشَهبَاء', 'جَزيرَة أَرواد', 'بِلاد
الرافِدَين', 'أهرامات الجِيزَة', 'دِرْع', 'عِيد', 'عُود', 'رِدْء',
'إِيدَاء', 'هِبَة الله', 'قاضٍ','المبارك','اختبار');
$string=implode(",",$ar_terms);
$result = array();
foreach ($ar_terms as $term) {
// echo $Arabic->ar2en($term);
array_push($result, $Arabic->ar2en($term));
}
$result=implode(",",$result);
echo '</table></center>';
echo '<center>
<table border="0" cellspacing="2" cellpadding="5" width="500">
<tr>
<td>
Arabic text
</td>
<td>
English text
</td>
</tr>
<tr>
<td>
<textarea rows="8" cols="50" id = "ar"> '.$string.' </textarea>
</td>
<td>
<textarea rows="8" cols="50"> '.$result.'</textarea>
</td>
</tr>
<tr>
<td>
<input type = "button" value = "Convert to English" id = "convert"> </input>
</td>
<td>
</td>
</tr>
</table>';
?>
</div><br />
<script>
$( "#convert" ).click(function() {
var arabic = document.getElementById("ar").value;
<?php $ar_terms = "<script>document.write(arabic)</script>"?>
var test = new Array();
test='<?php echo $ar_terms; ?>';
alert(test);
<?php
$string=implode(",",$ar_terms);
$result = array();
foreach ($ar_terms as $term) {
// echo $Arabic->ar2en($term);
array_push($result, $Arabic->ar2en($term));
}
$result=implode(",",$result);
?>
var arabic = new Array();
arabic='<?php echo $result; ?>';
alert(arabic);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment