Language names
Text_LanguageDetect works with language names. It accepts language names for a number of methods, e.g. omitLanguages() and returns language names. By default, a "language name" is a lowercase english name of a language.
Often, applications work with ISO 639-1 or ISO 639-2 language codes - two-letter or three letter codes. Text_LanguageDetect supports them since version 0.3.0, and you may enable them with setNameMode():
<?php
$text = 'Das ist ein kleiner deutscher Text';
require_once 'Text/LanguageDetect.php';
$ld = new Text_LanguageDetect();
//default mode: full language name: "german"
echo $ld->detectSimple($text) . "\n";
//two-letter mode: "de"
$ld->setNameMode(2);
echo $ld->detectSimple($text) . "\n";
//three-letter mode: "deu"
$ld->setNameMode(3);
echo $ld->detectSimple($text) . "\n";
?>
The above example gives the following output:
Output
german de deu