2012-05-12 08:55:18 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Demonstrates how to use ISO language codes.
|
|
|
|
*
|
|
|
|
* The "name mode" changes the way languages are accepted and returned.
|
|
|
|
*/
|
|
|
|
require_once 'Text/LanguageDetect.php';
|
2017-09-04 07:52:14 +00:00
|
|
|
$ld = new Text_LanguageDetect();
|
2012-05-12 08:55:18 +00:00
|
|
|
|
|
|
|
//will output the ISO 639-1 two-letter language code
|
|
|
|
// "de"
|
2017-09-04 07:52:14 +00:00
|
|
|
$ld->setNameMode(2);
|
|
|
|
echo $ld->detectSimple('Das ist ein kleiner Text') . "\n";
|
2012-05-12 08:55:18 +00:00
|
|
|
|
|
|
|
//will output the ISO 639-2 three-letter language code
|
|
|
|
// "deu"
|
2017-09-04 07:52:14 +00:00
|
|
|
$ld->setNameMode(3);
|
|
|
|
echo $ld->detectSimple('Das ist ein kleiner Text') . "\n";
|
|
|
|
?>
|