I know that in Wordpress we can do the following:
preg_match("/\p{Arabic}/u",
get_the_title())
How can we do this in JavaScript? Thanks in advance.
I know that in Wordpress we can do the following:
preg_match("/\p{Arabic}/u",
get_the_title())
How can we do this in JavaScript? Thanks in advance.
You could do this via the Google Language API Detect language from string in PHP
Since you know how to detect your language in php then its just a simple matter of passing a value from your php code to your javascript code.
eg.
<?php $language = get_language_on_whatever_way_you_want(); ?>
<script type="text/javascript">
function alertMeTheLanguage() {
var language = '<?php echo $language; ?>';
alert('Your language is <?php echo $language; ?> ' );
}
</script>