friendica-github/library/langdet/docs/iso.php

20 lines
500 B
PHP
Raw Normal View History

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';
$ld = new Text_LanguageDetect();
2012-05-12 08:55:18 +00:00
//will output the ISO 639-1 two-letter language code
// "de"
$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"
$ld->setNameMode(3);
echo $ld->detectSimple('Das ist ein kleiner Text') . "\n";
?>