Alex Rivera | Logout

How to check if the word is Japanese or English using PHP

Asked 2010-05-18T11:54:41.573
13

I want to have different process for English word and Japanese word in this function

function process_word($word) {
   if($word is english) {
     /////////
   }else if($word is japanese) {
      ////////
   }
}

thank you

Edit
Report

2 Answers

3

You could try Google's Translation API that has a detection function: http://code.google.com/apis/language/translate/v2/using_rest.html#detect-language

answered 2010-05-18T11:57:51.473
0

English text usually consists only of ASCII characters (or better say, characters in ASCII range).

answered 2010-05-18T11:57:45.953

Your Answer