Horde_Core_Factory_LanguageDetect
extends Horde_Core_Factory_Base
in package
A Horde_Injector:: based Text_LanguageDetect:: factory.
Copyright 2011-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
Properties
- $_detect : Text_LanguageDetect
- A Text_LanguageDetect instance.
- $_injector : Horde_Injector
- The injector.
- $_langmap : array<string|int, mixed>
- Mapping of language -> ISO 639 language codes.
Methods
- __construct() : mixed
- Constructor.
- create() : Text_LanguageDetect
- Return a Text_LanguageDetect instance.
- getLanguageCode() : string
- Utility method to scan a string and return the appropriate langauge code of the detected language.
- _getDriverName() : string
- Return the classname of the driver to load.
Properties
$_detect
A Text_LanguageDetect instance.
protected
Text_LanguageDetect
$_detect
$_injector
The injector.
protected
Horde_Injector
$_injector
$_langmap
Mapping of language -> ISO 639 language codes.
protected
array<string|int, mixed>
$_langmap
= array(
'albanian' => 'sq',
'arabic' => 'ar',
// azeri
'bengali' => 'bn',
'bulgarian' => 'bg',
// cebuano
'croatian' => 'hr',
'czech' => 'cs',
'danish' => 'da',
'dutch' => 'nl',
'english' => 'en',
'estonian' => 'et',
// farsi
'finnish' => 'fi',
'french' => 'fr',
'german' => 'de',
'hausa' => 'ha',
// hawaiian
'hindi' => 'hi',
'hungarian' => 'hu',
'icelandic' => 'is',
'indonesian' => 'id',
'italian' => 'it',
'kazakh' => 'kk',
'kyrgyz' => 'ky',
'latin' => 'la',
'latvian' => 'lv',
'lithuanian' => 'lt',
'macedonian' => 'mk',
'mongolian' => 'mn',
'nepali' => 'ne',
'norwegian' => 'no',
'pashto' => 'ps',
// pidgin
'polish' => 'pl',
'portuguese' => 'pt',
'romanian' => 'ro',
'russian' => 'ru',
'serbian' => 'sr',
'slovak' => 'sk',
'slovene' => 'sl',
'somali' => 'so',
'spanish' => 'es',
'swahili' => 'sw',
'swedish' => 'sv',
'tagalog' => 'tl',
'turkish' => 'tr',
'ukrainian' => 'uk',
'urdu' => 'ur',
'uzbek' => 'uz',
'vietnamese' => 'vi',
'welsh' => 'cy',
)
Language list accurate as of Text_LanguageDetect v0.2.3.
Methods
__construct()
Constructor.
public
__construct(Horde_Injector $injector) : mixed
Parameters
- $injector : Horde_Injector
-
The injector to use.
create()
Return a Text_LanguageDetect instance.
public
create() : Text_LanguageDetect
Tags
Return values
Text_LanguageDetect —Detection object.
getLanguageCode()
Utility method to scan a string and return the appropriate langauge code of the detected language.
public
getLanguageCode(string $text) : string
Parameters
- $text : string
-
Input text.
Return values
string —The ISO 639 language code (or null if it could not be determined).
_getDriverName()
Return the classname of the driver to load.
protected
_getDriverName(string $driver, string $base) : string
Parameters
- $driver : string
-
Driver name.
- $base : string
-
The base classname.
Tags
Return values
string —Classname.