From: Hypolite Petovan <hypolite@mrpetovan.com> Date: Sun, 4 Oct 2020 02:00:44 +0000 (-0400) Subject: [langfilter] Replace remove Text_Language_Detect dependency by matriphe/iso-639 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=023b3a4a76d6f3456bca91f37218d23187734f0c;p=friendica-addons.git [langfilter] Replace remove Text_Language_Detect dependency by matriphe/iso-639 - Address https://github.com/friendica/friendica/issues/9250#issuecomment-703153334 --- diff --git a/langfilter/composer.json b/langfilter/composer.json new file mode 100644 index 00000000..2f4f460f --- /dev/null +++ b/langfilter/composer.json @@ -0,0 +1,23 @@ +{ + "name": "friendica-addons/langfilter", + "description": "A language filter to collapse posts matching user-selected languages", + "type": "friendica-addon", + "require": { + "matriphe/iso-639": "^1.2" + }, + "license": "AGPL-3", + "authors": [ + { + "name": "Tobias Diekershoff", + "homepage": "https://f.diekershoff.de/u/tobias", + "role": "Developer" + }, + { + "name": "Hypolite Petovan", + "email": "hypolite@mrpetovan.com", + "homepage": "https://friendica.mrpetovan.com/profile/hypolite", + "role": "Maintainer" + } + ], + "minimum-stability": "stable" +} diff --git a/langfilter/composer.lock b/langfilter/composer.lock new file mode 100644 index 00000000..0c6baf66 --- /dev/null +++ b/langfilter/composer.lock @@ -0,0 +1,63 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "7524bbd9381490bdfd604a84385da630", + "packages": [ + { + "name": "matriphe/iso-639", + "version": "1.2", + "source": { + "type": "git", + "url": "https://github.com/matriphe/php-iso-639.git", + "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/matriphe/php-iso-639/zipball/0245d844daeefdd22a54b47103ffdb0e03c323e1", + "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^4.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matriphe\\ISO639\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Muhammad Zamroni", + "email": "halo@matriphe.com" + } + ], + "description": "PHP library to convert ISO-639-1 code to language name.", + "keywords": [ + "639", + "iso", + "iso-639", + "lang", + "language", + "laravel" + ], + "time": "2017-07-19T15:11:19+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 95488421..5c5f797a 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -13,6 +13,8 @@ use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; +require __DIR__ . '/vendor/autoload.php'; + /* Define the hooks we want to use * that is, we have settings, we need to save the settings and we want * to modify the content of a posting when friendica prepares it. @@ -138,6 +140,8 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data) } $read_languages_array = explode(',', $read_languages_string); + $iso639 = new Matriphe\ISO639\ISO639; + // Extract the language of the post if (!empty($hook_data['item']['language'])) { $languages = json_decode($hook_data['item']['language'], true); @@ -153,7 +157,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data) return; } - $lang = Text_LanguageDetect_ISO639::code2ToName($iso2); + $lang = $iso639->languageByCode1($iso2); } else { $opts = $hook_data['item']['postopts']; if (!$opts) { @@ -169,7 +173,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data) $lang = $matches[1]; $confidence = $matches[2]; - $iso2 = Text_LanguageDetect_ISO639::nameToCode2($lang); + $iso2 = $iso639->code1ByLanguage($lang); } // Do not filter if language detection confidence is too low diff --git a/langfilter/vendor/autoload.php b/langfilter/vendor/autoload.php new file mode 100644 index 00000000..23e5df1e --- /dev/null +++ b/langfilter/vendor/autoload.php @@ -0,0 +1,7 @@ +<?php + +// autoload.php @generated by Composer + +require_once __DIR__ . '/composer/autoload_real.php'; + +return ComposerAutoloaderInit6449f021327d95a4e323188b673aed62::getLoader(); diff --git a/langfilter/vendor/composer/ClassLoader.php b/langfilter/vendor/composer/ClassLoader.php new file mode 100644 index 00000000..fce8549f --- /dev/null +++ b/langfilter/vendor/composer/ClassLoader.php @@ -0,0 +1,445 @@ +<?php + +/* + * This file is part of Composer. + * + * (c) Nils Adermann <naderman@naderman.de> + * Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Jordi Boggiano <j.boggiano@seld.be> + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/langfilter/vendor/composer/LICENSE b/langfilter/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/langfilter/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/langfilter/vendor/composer/autoload_classmap.php b/langfilter/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..7a91153b --- /dev/null +++ b/langfilter/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ +<?php + +// autoload_classmap.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +); diff --git a/langfilter/vendor/composer/autoload_namespaces.php b/langfilter/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..b7fc0125 --- /dev/null +++ b/langfilter/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ +<?php + +// autoload_namespaces.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +); diff --git a/langfilter/vendor/composer/autoload_psr4.php b/langfilter/vendor/composer/autoload_psr4.php new file mode 100644 index 00000000..9e639fd7 --- /dev/null +++ b/langfilter/vendor/composer/autoload_psr4.php @@ -0,0 +1,10 @@ +<?php + +// autoload_psr4.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( + 'Matriphe\\ISO639\\' => array($vendorDir . '/matriphe/iso-639/src'), +); diff --git a/langfilter/vendor/composer/autoload_real.php b/langfilter/vendor/composer/autoload_real.php new file mode 100644 index 00000000..fed9c349 --- /dev/null +++ b/langfilter/vendor/composer/autoload_real.php @@ -0,0 +1,55 @@ +<?php + +// autoload_real.php @generated by Composer + +class ComposerAutoloaderInit6449f021327d95a4e323188b673aed62 +{ + private static $loader; + + public static function loadClassLoader($class) + { + if ('Composer\Autoload\ClassLoader' === $class) { + require __DIR__ . '/ClassLoader.php'; + } + } + + /** + * @return \Composer\Autoload\ClassLoader + */ + public static function getLoader() + { + if (null !== self::$loader) { + return self::$loader; + } + + spl_autoload_register(array('ComposerAutoloaderInit6449f021327d95a4e323188b673aed62', 'loadClassLoader'), true, true); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + spl_autoload_unregister(array('ComposerAutoloaderInit6449f021327d95a4e323188b673aed62', 'loadClassLoader')); + + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit6449f021327d95a4e323188b673aed62::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/langfilter/vendor/composer/autoload_static.php b/langfilter/vendor/composer/autoload_static.php new file mode 100644 index 00000000..51ac8bdf --- /dev/null +++ b/langfilter/vendor/composer/autoload_static.php @@ -0,0 +1,31 @@ +<?php + +// autoload_static.php @generated by Composer + +namespace Composer\Autoload; + +class ComposerStaticInit6449f021327d95a4e323188b673aed62 +{ + public static $prefixLengthsPsr4 = array ( + 'M' => + array ( + 'Matriphe\\ISO639\\' => 16, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Matriphe\\ISO639\\' => + array ( + 0 => __DIR__ . '/..' . '/matriphe/iso-639/src', + ), + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit6449f021327d95a4e323188b673aed62::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit6449f021327d95a4e323188b673aed62::$prefixDirsPsr4; + + }, null, ClassLoader::class); + } +} diff --git a/langfilter/vendor/composer/installed.json b/langfilter/vendor/composer/installed.json new file mode 100644 index 00000000..796c98f3 --- /dev/null +++ b/langfilter/vendor/composer/installed.json @@ -0,0 +1,48 @@ +[ + { + "name": "matriphe/iso-639", + "version": "1.2", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/matriphe/php-iso-639.git", + "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/matriphe/php-iso-639/zipball/0245d844daeefdd22a54b47103ffdb0e03c323e1", + "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^4.7" + }, + "time": "2017-07-19T15:11:19+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Matriphe\\ISO639\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Muhammad Zamroni", + "email": "halo@matriphe.com" + } + ], + "description": "PHP library to convert ISO-639-1 code to language name.", + "keywords": [ + "639", + "iso", + "iso-639", + "lang", + "language", + "laravel" + ] + } +] diff --git a/langfilter/vendor/matriphe/iso-639/.gitignore b/langfilter/vendor/matriphe/iso-639/.gitignore new file mode 100644 index 00000000..8b7ef350 --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/.gitignore @@ -0,0 +1,2 @@ +/vendor +composer.lock diff --git a/langfilter/vendor/matriphe/iso-639/.php_cs b/langfilter/vendor/matriphe/iso-639/.php_cs new file mode 100644 index 00000000..e862e68d --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/.php_cs @@ -0,0 +1,122 @@ +<?php + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'long'], + 'no_extra_consecutive_blank_lines' => [ + 'break', 'continue', 'extra', 'return', 'throw', 'use', + 'parenthesis_brace_block', 'square_brace_block', + 'curly_brace_block' + ], + 'binary_operator_spaces' => true, + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'braces' => true, + 'blank_line_before_return' => true, + 'cast_spaces' => true, + 'class_definition' => true, + 'class_keyword_remove' => false, + 'concat_space' => true, + 'combine_consecutive_unsets' => true, + 'declare_equal_normalize' => false, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'function_typehint_space' => true, + 'hash_to_slash_comment' => true, + 'indentation_type' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + //'mb_str_functions' => false, + 'method_argument_space' => true, + 'method_separation' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'new_with_braces' => true, + //'no_alias_functions' => false, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => false, + 'no_blank_lines_before_namespace' => false, + 'no_closing_tag' => true, + 'no_empty_comment' => false, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiline_whitespace_before_semicolons' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_successor_space' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => true, + 'ordered_imports' => true, + 'php_unit_strict' => false, + /* + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_scalar' => true, + */ + 'protected_to_private' => true, + 'psr4' => true, + 'random_api_migration' => true, + 'return_type_declaration' => false, + 'self_accessor' => true, + //'semicolon_after_instruction' => true, + 'short_scalar_cast' => true, + //'simplified_null_return' => false, + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'strict_comparison' => false, + 'strict_param' => false, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'whitespace_after_comma_in_array' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('storage') + ->in(__DIR__) + ) +; \ No newline at end of file diff --git a/langfilter/vendor/matriphe/iso-639/.travis.yml b/langfilter/vendor/matriphe/iso-639/.travis.yml new file mode 100644 index 00000000..4e807d90 --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/.travis.yml @@ -0,0 +1,13 @@ +language: php + +install: composer install + +script: vendor/bin/phpunit + +php: + - "7.1" + - "7.0" + - "5.6" + - "5.5" + - "5.4" + - "5.3" diff --git a/langfilter/vendor/matriphe/iso-639/README.md b/langfilter/vendor/matriphe/iso-639/README.md new file mode 100644 index 00000000..7a0b0eb1 --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/README.md @@ -0,0 +1,65 @@ +# PHP ISO-639 + +[](https://travis-ci.org/matriphe/php-iso-639) + +PHP library to convert ISO-639-1 code to language name, based on Wikipedia's [List of ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + +## Installation + +Using composer: `composer require matriphe/iso-639` + +## Usage Example + +```php +<?php + +required 'src/ISO639.php'; +//required 'vendor/autoload.php'; // If using composer + +$iso = new Matriphe\ISO639\ISO639; + +// Get language name from ISO-639-1 code +echo $iso->languageByCode1('en'); // English +echo $iso->languageByCode1('id'); // Indonesian +echo $iso->languageByCode1('jv'); // Javanese + +// Get native language name from ISO-639-1 code +echo $iso->nativeByCode1('en'); // English +echo $iso->nativeByCode1('id'); // Bahasa Indonesia +echo $iso->nativeByCode1('jv'); // basa Jawa + +// Get language name from ISO-639-2t code +echo $iso->languageByCode2t('eng'); // English +echo $iso->languageByCode2t('ind'); // Indonesian +echo $iso->languageByCode2t('jav'); // Javanese + +// Get native language name from ISO-639-2t code +echo $iso->nativeByCode2t('eng'); // English +echo $iso->nativeByCode2t('ind'); // Bahasa Indonesia +echo $iso->nativeByCode2t('jav'); // basa Jawa + +// Get language name from ISO-639-2b code +echo $iso->languageByCode2b('eng'); // English +echo $iso->languageByCode2b('ind'); // Indonesian +echo $iso->languageByCode2b('jav'); // Javanese + +// Get native language name from ISO-639-2b code +echo $iso->nativeByCode2b('eng'); // English +echo $iso->nativeByCode2b('ind'); // Bahasa Indonesia +echo $iso->nativeByCode2b('jav'); // basa Jawa + +// Get language name from ISO-639-3 code +echo $iso->languageByCode3('eng'); // English +echo $iso->languageByCode3('ind'); // Indonesian +echo $iso->languageByCode3('jav'); // Javanese + +// Get native language name from ISO-639-3 code +echo $iso->nativeByCode3('eng'); // English +echo $iso->nativeByCode3('ind'); // Bahasa Indonesia +echo $iso->nativeByCode3('jav'); // basa Jawa + +``` + +## To Do + +* Convert language name to ISO-639 code \ No newline at end of file diff --git a/langfilter/vendor/matriphe/iso-639/composer.json b/langfilter/vendor/matriphe/iso-639/composer.json new file mode 100644 index 00000000..ec74c13c --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/composer.json @@ -0,0 +1,22 @@ +{ + "name": "matriphe/iso-639", + "description": "PHP library to convert ISO-639-1 code to language name.", + "keywords": ["iso", "iso-639", "639", "lang", "language", "laravel"], + "type": "library", + "require-dev": { + "phpunit/phpunit": "^4.7" + }, + "license": "MIT", + "authors": [ + { + "name": "Muhammad Zamroni", + "email": "halo@matriphe.com" + } + ], + "require": {}, + "autoload": { + "psr-4": { + "Matriphe\\ISO639\\": "src/" + } + } +} diff --git a/langfilter/vendor/matriphe/iso-639/phpunit.xml b/langfilter/vendor/matriphe/iso-639/phpunit.xml new file mode 100644 index 00000000..9ef10b1e --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/phpunit.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit bootstrap="src/ISO639.php"> + <testsuites> + <testsuite name="ISO-639 Test Unit"> + <directory>tests/ISO639Test.php</directory> + </testsuite> + </testsuites> + +</phpunit> diff --git a/langfilter/vendor/matriphe/iso-639/resources/iso-639.csv.gz b/langfilter/vendor/matriphe/iso-639/resources/iso-639.csv.gz new file mode 100644 index 00000000..e19eb777 Binary files /dev/null and b/langfilter/vendor/matriphe/iso-639/resources/iso-639.csv.gz differ diff --git a/langfilter/vendor/matriphe/iso-639/resources/iso-639.sql.gz b/langfilter/vendor/matriphe/iso-639/resources/iso-639.sql.gz new file mode 100644 index 00000000..bb5d15eb Binary files /dev/null and b/langfilter/vendor/matriphe/iso-639/resources/iso-639.sql.gz differ diff --git a/langfilter/vendor/matriphe/iso-639/resources/wikipedia.csv b/langfilter/vendor/matriphe/iso-639/resources/wikipedia.csv new file mode 100644 index 00000000..67dc7f57 --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/resources/wikipedia.csv @@ -0,0 +1,185 @@ +Northwest Caucasian|Abkhaz|аҧÑÑа бÑзÑÓа, аҧÑÑÓа|ab|abk|abk|abk|abks| +Afro-Asiatic|Afar|Afaraf|aa|aar|aar|aar|aars| +Indo-European|Afrikaans|Afrikaans|af|afr|afr|afr|afrs| +NigerâCongo|Akan|Akan|ak|aka|aka|aka + 2||macrolanguage, Twi is [tw/twi], Fanti is [fat] +Indo-European|Albanian|Shqip|sq|sqi|alb|sqi + 4||macrolanguage, "Albanian Phylozone" in 639-6 +Afro-Asiatic|Amharic|á ááá|am|amh|amh|amh|| +Afro-Asiatic|Arabic|Ø§ÙØ¹Ø±Ø¨ÙØ©|ar|ara|ara|ara + 30||macrolanguage, Standard Arabic is [arb] +Indo-European|Aragonese|aragonés|an|arg|arg|arg|| +Indo-European|Armenian|ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶|hy|hye|arm|hye|| +Indo-European|Assamese|ঠসমà§à¦¯à¦¼à¦¾|as|asm|asm|asm|| +Northeast Caucasian|Avaric|Ð°Ð²Ð°Ñ Ð¼Ð°ÑÓ, магÓаÑÑл маÑÓ|av|ava|ava|ava|| +Indo-European|Avestan|avesta|ae|ave|ave|ave||ancient +Aymaran|Aymara|aymar aru|ay|aym|aym|aym + 2||macrolanguage +Turkic|Azerbaijani|azÉrbaycan dili|az|aze|aze|aze + 2||macrolanguage +NigerâCongo|Bambara|bamanankan|bm|bam|bam|bam|| +Turkic|Bashkir|баÑҡоÑÑ Ñеле|ba|bak|bak|bak|| +Language isolate|Basque|euskara, euskera|eu|eus|baq|eus|| +Indo-European|Belarusian|белаÑÑÑÐºÐ°Ñ Ð¼Ð¾Ð²Ð°|be|bel|bel|bel|| +Indo-European|Bengali, Bangla|বাà¦à¦²à¦¾|bn|ben|ben|ben|| +Indo-European|Bihari|à¤à¥à¤à¤ªà¥à¤°à¥|bh|bih|bih|||Collective language code for Bhojpuri, Magahi, and Maithili +Creole|Bislama|Bislama|bi|bis|bis|bis|| +Indo-European|Bosnian|bosanski jezik|bs|bos|bos|bos|boss| +Indo-European|Breton|brezhoneg|br|bre|bre|bre|| +Indo-European|Bulgarian|бÑлгаÑÑки език|bg|bul|bul|bul|buls| +Sino-Tibetan|Burmese|ááá¬á á¬|my|mya|bur|mya|| +Indo-European|Catalan|català |ca|cat|cat|cat|| +Austronesian|Chamorro|Chamoru|ch|cha|cha|cha|| +Northeast Caucasian|Chechen|Ð½Ð¾Ñ Ñийн моÑÑ|ce|che|che|che|| +NigerâCongo|Chichewa, Chewa, Nyanja|chiCheŵa, chinyanja|ny|nya|nya|nya|| +Sino-Tibetan|Chinese|䏿 (ZhÅngwén), æ±è¯, æ¼¢èª|zh|zho|chi|zho + 13||macrolanguage +Turkic|Chuvash|ÑÓÐ²Ð°Ñ ÑÓÐ»Ñ Ð¸|cv|chv|chv|chv|| +Indo-European|Cornish|Kernewek|kw|cor|cor|cor|| +Indo-European|Corsican|corsu, lingua corsa|co|cos|cos|cos|| +Algonquian|Cree|áá¦ááááá£|cr|cre|cre|cre + 6||macrolanguage +Indo-European|Croatian|hrvatski jezik|hr|hrv|hrv|hrv|| +Indo-European|Czech|ÄeÅ¡tina, Äeský jazyk|cs|ces|cze|ces|| +Indo-European|Danish|dansk|da|dan|dan|dan|| +Indo-European|Divehi, Dhivehi, Maldivian|ÞÞ¨ÞÞ¬ÞÞ¨|dv|div|div|div|| +Indo-European|Dutch|Nederlands, Vlaams|nl|nld|dut|nld|| +Sino-Tibetan|Dzongkha|རྫོà½à¼à½|dz|dzo|dzo|dzo|| +Indo-European|English|English|en|eng|eng|eng|engs| +Constructed|Esperanto|Esperanto|eo|epo|epo|epo||constructed, initiated from L.L. Zamenhof, 1887 +Uralic|Estonian|eesti, eesti keel|et|est|est|est + 2||macrolanguage +NigerâCongo|Ewe|EÊegbe|ee|ewe|ewe|ewe|| +Indo-European|Faroese|føroyskt|fo|fao|fao|fao|| +Austronesian|Fijian|vosa Vakaviti|fj|fij|fij|fij|| +Uralic|Finnish|suomi, suomen kieli|fi|fin|fin|fin|| +Indo-European|French|français, langue française|fr|fra|fre|fra|fras| +NigerâCongo|Fula, Fulah, Pulaar, Pular|Fulfulde, Pulaar, Pular|ff|ful|ful|ful + 9||macrolanguage +Indo-European|Galician|galego|gl|glg|glg|glg|| +South Caucasian|Georgian|á¥áá áá£áá|ka|kat|geo|kat|| +Indo-European|German|Deutsch|de|deu|ger|deu|deus| +Indo-European|Greek (modern)|ελληνικά|el|ell|gre|ell|ells| +Tupian|GuaranÃ|Avañe'ẽ|gn|grn|grn|grn + 5||macrolanguage +Indo-European|Gujarati|àªà«àªàª°àª¾àª¤à«|gu|guj|guj|guj|| +Creole|Haitian, Haitian Creole|Kreyòl ayisyen|ht|hat|hat|hat|| +Afro-Asiatic|Hausa|(Hausa) ÙÙÙÙØ³Ù|ha|hau|hau|hau|| +Afro-Asiatic|Hebrew (modern)|×¢×ר×ת|he|heb|heb|heb|| +NigerâCongo|Herero|Otjiherero|hz|her|her|her|| +Indo-European|Hindi|हिनà¥à¤¦à¥, हिà¤à¤¦à¥|hi|hin|hin|hin|hins| +Austronesian|Hiri Motu|Hiri Motu|ho|hmo|hmo|hmo|| +Uralic|Hungarian|magyar|hu|hun|hun|hun|| +Constructed|Interlingua|Interlingua|ia|ina|ina|ina||constructed by International Auxiliary Language Association +Austronesian|Indonesian|Bahasa Indonesia|id|ind|ind|ind||Covered by macrolanguage [ms/msa] +Constructed|Interlingue|Originally called Occidental; then Interlingue after WWII|ie|ile|ile|ile||constructed by Edgar de Wahl, first published in 1922 +Indo-European|Irish|Gaeilge|ga|gle|gle|gle|| +NigerâCongo|Igbo|Asụsụ Igbo|ig|ibo|ibo|ibo|| +EskimoâAleut|Inupiaq|Iñupiaq, Iñupiatun|ik|ipk|ipk|ipk + 2||macrolanguage +Constructed|Ido|Ido|io|ido|ido|ido|idos|constructed by De Beaufront, 1907, as variation of Esperanto +Indo-European|Icelandic|Ãslenska|is|isl|ice|isl|| +Indo-European|Italian|italiano|it|ita|ita|ita|itas| +EskimoâAleut|Inuktitut|áááááá¦|iu|iku|iku|iku + 2||macrolanguage +Japonic|Japanese|æ¥æ¬èª (ã«ã»ãã)|ja|jpn|jpn|jpn|| +Austronesian|Javanese|basa Jawa|jv|jav|jav|jav|| +EskimoâAleut|Kalaallisut, Greenlandic|kalaallisut, kalaallit oqaasii|kl|kal|kal|kal|| +Dravidian|Kannada|à²à²¨à³à²¨à²¡|kn|kan|kan|kan|| +Nilo-Saharan|Kanuri|Kanuri|kr|kau|kau|kau + 3||macrolanguage +Indo-European|Kashmiri|à¤à¤¶à¥à¤®à¥à¤°à¥, ÙØ´Ù ÙØ±Ùâ|ks|kas|kas|kas|| +Turkic|Kazakh|ÒÐ°Ð·Ð°Ò ÑÑлÑ|kk|kaz|kaz|kaz|| +Austroasiatic|Khmer|ááááá, áááááá¶áá¶, áá¶áá¶ááááá|km|khm|khm|khm||a.k.a. Cambodian +NigerâCongo|Kikuyu, Gikuyu|GÄ©kÅ©yÅ©|ki|kik|kik|kik|| +NigerâCongo|Kinyarwanda|Ikinyarwanda|rw|kin|kin|kin|| +Turkic|Kyrgyz|ÐÑÑгÑзÑа, ÐÑÑгÑз Ñили|ky|kir|kir|kir|| +Uralic|Komi|коми кÑв|kv|kom|kom|kom + 2||macrolanguage +NigerâCongo|Kongo|Kikongo|kg|kon|kon|kon + 3||macrolanguage +Koreanic|Korean|íêµì´, ì¡°ì ì´|ko|kor|kor|kor|| +Indo-European|Kurdish|Kurdî, ÙÙØ±Ø¯Ûâ|ku|kur|kur|kur + 3||macrolanguage +NigerâCongo|Kwanyama, Kuanyama|Kuanyama|kj|kua|kua|kua|| +Indo-European|Latin|latine, lingua latina|la|lat|lat|lat|lats|ancient +Indo-European|Ladin|ladin, lingua ladina||||lld|| +Indo-European|Luxembourgish, Letzeburgesch|Lëtzebuergesch|lb|ltz|ltz|ltz|| +NigerâCongo|Ganda|Luganda|lg|lug|lug|lug|| +Indo-European|Limburgish, Limburgan, Limburger|Limburgs|li|lim|lim|lim|| +NigerâCongo|Lingala|Lingála|ln|lin|lin|lin|| +TaiâKadai|Lao|àºàº²àºªàº²àº¥àº²àº§|lo|lao|lao|lao|| +Indo-European|Lithuanian|lietuvių kalba|lt|lit|lit|lit|| +NigerâCongo|Luba-Katanga|Tshiluba|lu|lub|lub|lub|| +Indo-European|Latvian|latvieÅ¡u valoda|lv|lav|lav|lav + 2||macrolanguage +Indo-European|Manx|Gaelg, Gailck|gv|glv|glv|glv|| +Indo-European|Macedonian|македонÑки Ñазик|mk|mkd|mac|mkd|| +Austronesian|Malagasy|fiteny malagasy|mg|mlg|mlg|mlg + 10||macrolanguage +Austronesian|Malay|bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ|ms|msa|may|msa + 13||macrolanguage, Standard Malay is [zsm], Indonesian is [id/ind] +Dravidian|Malayalam|മലയാളà´|ml|mal|mal|mal|| +Afro-Asiatic|Maltese|Malti|mt|mlt|mlt|mlt|| +Austronesian|MÄori|te reo MÄori|mi|mri|mao|mri|| +Indo-European|Marathi (MarÄá¹hÄ«)|मराठà¥|mr|mar|mar|mar|| +Austronesian|Marshallese|Kajin M̧ajeļ|mh|mah|mah|mah|| +Mongolic|Mongolian|монгол|mn|mon|mon|mon + 2||macrolanguage +Austronesian|Nauru|EkakairÅ© Naoero|na|nau|nau|nau|| +DenéâYeniseian|Navajo, Navaho|Diné bizaad|nv|nav|nav|nav|| +NigerâCongo|Northern Ndebele|isiNdebele|nd|nde|nde|nde|| +Indo-European|Nepali|नà¥à¤ªà¤¾à¤²à¥|ne|nep|nep|nep|| +NigerâCongo|Ndonga|Owambo|ng|ndo|ndo|ndo|| +Indo-European|Norwegian BokmÃ¥l|Norsk bokmÃ¥l|nb|nob|nob|nob||Covered by macrolanguage [no/nor] +Indo-European|Norwegian Nynorsk|Norsk nynorsk|nn|nno|nno|nno||Covered by macrolanguage [no/nor] +Indo-European|Norwegian|Norsk|no|nor|nor|nor + 2||macrolanguage, BokmÃ¥l is [nb/nob], Nynorsk is [nn/nno] +Sino-Tibetan|Nuosu|êê ê¿ Nuosuhxop|ii|iii|iii|iii||Standard form of Yi languages +NigerâCongo|Southern Ndebele|isiNdebele|nr|nbl|nbl|nbl|| +Indo-European|Occitan|occitan, lenga d'òc|oc|oci|oci|oci|| +Algonquian|Ojibwe, Ojibwa|ááááá¯á§áá|oj|oji|oji|oji + 7||macrolanguage +Indo-European|Old Church Slavonic, Church Slavonic, Old Bulgarian|ѩзÑÐºÑ ÑловѣнÑÑкÑ|cu|chu|chu|chu||ancient, in use by Orthodox Church +Afro-Asiatic|Oromo|Afaan Oromoo|om|orm|orm|orm + 4||macrolanguage +Indo-European|Oriya|à¬à¬¡à¬¼à¬¿à¬|or|ori|ori|ori|| +Indo-European|Ossetian, Ossetic|иÑон æвзаг|os|oss|oss|oss|| +Indo-European|Panjabi, Punjabi|ਪੰà¨à¨¾à¨¬à©, Ù¾ÙØ¬Ø§Ø¨Ûâ|pa|pan|pan|pan|| +Indo-European|PÄli|पाऴि|pi|pli|pli|pli||ancient +Indo-European|Persian (Farsi)|ÙØ§Ø±Ø³Û|fa|fas|per|fas + 2||macrolanguage +Indo-European|Polish|jÄzyk polski, polszczyzna|pl|pol|pol|pol|pols| +Indo-European|Pashto, Pushto|Ù¾ÚØªÙ|ps|pus|pus|pus + 3||macrolanguage +Indo-European|Portuguese|português|pt|por|por|por|| +Quechuan|Quechua|Runa Simi, Kichwa|qu|que|que|que + 44||macrolanguage +Indo-European|Romansh|rumantsch grischun|rm|roh|roh|roh|| +NigerâCongo|Kirundi|Ikirundi|rn|run|run|run|| +Indo-European|Romanian|limba românÄ|ro|ron|rum|ron||[mo] for Moldavian has been withdrawn, recommending [ro] also for Moldavian +Indo-European|Russian|Ð ÑÑÑкий|ru|rus|rus|rus|| +Indo-European|Sanskrit (Saá¹ská¹ta)|सà¤à¤¸à¥à¤à¥à¤¤à¤®à¥|sa|san|san|san||ancient, still spoken +Indo-European|Sardinian|sardu|sc|srd|srd|srd + 4||macrolanguage +Indo-European|Sindhi|सिनà¥à¤§à¥, سÙÚÙØ Ø³ÙØ¯Ú¾Ûâ|sd|snd|snd|snd|| +Uralic|Northern Sami|Davvisámegiella|se|sme|sme|sme|| +Austronesian|Samoan|gagana fa'a Samoa|sm|smo|smo|smo|| +Creole|Sango|yângâ tî sängö|sg|sag|sag|sag|| +Indo-European|Serbian|ÑÑпÑки Ñезик|sr|srp|srp|srp||The ISO 639-2/T code srp deprecated the ISO 639-2/B code scc[1] +Indo-European|Scottish Gaelic, Gaelic|Gà idhlig|gd|gla|gla|gla|| +NigerâCongo|Shona|chiShona|sn|sna|sna|sna|| +Indo-European|Sinhala, Sinhalese|à·à·à¶à·à¶½|si|sin|sin|sin|| +Indo-European|Slovak|slovenÄina, slovenský jazyk|sk|slk|slo|slk|| +Indo-European|Slovene|slovenski jezik, slovenÅ¡Äina|sl|slv|slv|slv|| +Afro-Asiatic|Somali|Soomaaliga, af Soomaali|so|som|som|som|| +NigerâCongo|Southern Sotho|Sesotho|st|sot|sot|sot|| +Indo-European|Spanish|español|es|spa|spa|spa|| +Austronesian|Sundanese|Basa Sunda|su|sun|sun|sun|| +NigerâCongo|Swahili|Kiswahili|sw|swa|swa|swa + 2||macrolanguage +NigerâCongo|Swati|SiSwati|ss|ssw|ssw|ssw|| +Indo-European|Swedish|svenska|sv|swe|swe|swe|| +Dravidian|Tamil|தமிழà¯|ta|tam|tam|tam|| +Dravidian|Telugu|à°¤à±à°²à±à°à±|te|tel|tel|tel|| +Indo-European|Tajik|Ñоҷикӣ, toçikÄ«, تاجÛÚ©Ûâ|tg|tgk|tgk|tgk|| +TaiâKadai|Thai|à¹à¸à¸¢|th|tha|tha|tha|| +Afro-Asiatic|Tigrinya|áµááá|ti|tir|tir|tir|| +Sino-Tibetan|Tibetan Standard, Tibetan, Central|à½à½¼à½à¼à½¡à½²à½|bo|bod|tib|bod|| +Turkic|Turkmen|Türkmen, ТүÑкмен|tk|tuk|tuk|tuk|| +Austronesian|Tagalog|Wikang Tagalog, áááá á áááááá|tl|tgl|tgl|tgl||Note: Filipino (Pilipino) has the code [fil] +NigerâCongo|Tswana|Setswana|tn|tsn|tsn|tsn|| +Austronesian|Tonga (Tonga Islands)|faka Tonga|to|ton|ton|ton|| +Turkic|Turkish|Türkçe|tr|tur|tur|tur|| +NigerâCongo|Tsonga|Xitsonga|ts|tso|tso|tso|| +Turkic|Tatar|ÑаÑÐ°Ñ Ñеле, tatar tele|tt|tat|tat|tat|| +NigerâCongo|Twi|Twi|tw|twi|twi|twi||Covered by macrolanguage [ak/aka] +Austronesian|Tahitian|Reo Tahiti|ty|tah|tah|tah||One of the Reo MÄ`ohi (languages of French Polynesia) +Turkic|Uyghur|ئÛÙØºÛرÚÛâ, Uyghurche|ug|uig|uig|uig|| +Indo-European|Ukrainian|ÑкÑаÑнÑÑка мова|uk|ukr|ukr|ukr|| +Indo-European|Urdu|اردÙ|ur|urd|urd|urd|| +Turkic|Uzbek|OÊ»zbek, Ðзбек, Ø£ÛØ²Ø¨ÛÙâ|uz|uzb|uzb|uzb + 2||macrolanguage +NigerâCongo|Venda|Tshivená¸a|ve|ven|ven|ven|| +Austroasiatic|Vietnamese|Viá»t Nam|vi|vie|vie|vie|| +Constructed|Volapük|Volapük|vo|vol|vol|vol||constructed +Indo-European|Walloon|walon|wa|wln|wln|wln|| +Indo-European|Welsh|Cymraeg|cy|cym|wel|cym|| +NigerâCongo|Wolof|Wollof|wo|wol|wol|wol|| +Indo-European|Western Frisian|Frysk|fy|fry|fry|fry|| +NigerâCongo|Xhosa|isiXhosa|xh|xho|xho|xho|| +Indo-European|Yiddish|××Ö´××ש|yi|yid|yid|yid + 2||macrolanguage +NigerâCongo|Yoruba|Yorùbá|yo|yor|yor|yor|| +TaiâKadai|Zhuang, Chuang|Saɯ cueÅÆ , Saw cuengh|za|zha|zha|zha + 16||macrolanguage +NigerâCongo|Zulu|isiZulu|zu|zul|zul|zul|| \ No newline at end of file diff --git a/langfilter/vendor/matriphe/iso-639/src/ISO639.php b/langfilter/vendor/matriphe/iso-639/src/ISO639.php new file mode 100644 index 00000000..13f9942a --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/src/ISO639.php @@ -0,0 +1,460 @@ +<?php + +namespace Matriphe\ISO639; + +class ISO639 +{ + /* + * Language database, based on Wikipedia. + * Source: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + */ + protected $languages = array( + array('ab', 'abk', 'abk', 'abk', 'Abkhaz', 'аҧÑÑа бÑзÑÓа, аҧÑÑÓа'), + array('aa', 'aar', 'aar', 'aar', 'Afar', 'Afaraf'), + array('af', 'afr', 'afr', 'afr', 'Afrikaans', 'Afrikaans'), + array('ak', 'aka', 'aka', 'aka', 'Akan', 'Akan'), + array('sq', 'sqi', 'alb', 'sqi', 'Albanian', 'Shqip'), + array('am', 'amh', 'amh', 'amh', 'Amharic', 'á ááá'), + array('ar', 'ara', 'ara', 'ara', 'Arabic', 'Ø§ÙØ¹Ø±Ø¨ÙØ©'), + array('an', 'arg', 'arg', 'arg', 'Aragonese', 'aragonés'), + array('hy', 'hye', 'arm', 'hye', 'Armenian', 'ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶'), + array('as', 'asm', 'asm', 'asm', 'Assamese', 'ঠসমà§à¦¯à¦¼à¦¾'), + array('av', 'ava', 'ava', 'ava', 'Avaric', 'Ð°Ð²Ð°Ñ Ð¼Ð°ÑÓ, магÓаÑÑл маÑÓ'), + array('ae', 'ave', 'ave', 'ave', 'Avestan', 'avesta'), + array('ay', 'aym', 'aym', 'aym', 'Aymara', 'aymar aru'), + array('az', 'aze', 'aze', 'aze', 'Azerbaijani', 'azÉrbaycan dili'), + array('bm', 'bam', 'bam', 'bam', 'Bambara', 'bamanankan'), + array('ba', 'bak', 'bak', 'bak', 'Bashkir', 'баÑҡоÑÑ Ñеле'), + array('eu', 'eus', 'baq', 'eus', 'Basque', 'euskara, euskera'), + array('be', 'bel', 'bel', 'bel', 'Belarusian', 'белаÑÑÑÐºÐ°Ñ Ð¼Ð¾Ð²Ð°'), + array('bn', 'ben', 'ben', 'ben', 'Bengali, Bangla', 'বাà¦à¦²à¦¾'), + array('bh', 'bih', 'bih', '', 'Bihari', 'à¤à¥à¤à¤ªà¥à¤°à¥'), + array('bi', 'bis', 'bis', 'bis', 'Bislama', 'Bislama'), + array('bs', 'bos', 'bos', 'bos', 'Bosnian', 'bosanski jezik'), + array('br', 'bre', 'bre', 'bre', 'Breton', 'brezhoneg'), + array('bg', 'bul', 'bul', 'bul', 'Bulgarian', 'бÑлгаÑÑки език'), + array('my', 'mya', 'bur', 'mya', 'Burmese', 'ááá¬á á¬'), + array('ca', 'cat', 'cat', 'cat', 'Catalan', 'català '), + array('ch', 'cha', 'cha', 'cha', 'Chamorro', 'Chamoru'), + array('ce', 'che', 'che', 'che', 'Chechen', 'Ð½Ð¾Ñ Ñийн моÑÑ'), + array('ny', 'nya', 'nya', 'nya', 'Chichewa, Chewa, Nyanja', 'chiCheŵa, chinyanja'), + array('zh', 'zho', 'chi', 'zho', 'Chinese', '䏿 (ZhÅngwén), æ±è¯, æ¼¢èª'), + array('cv', 'chv', 'chv', 'chv', 'Chuvash', 'ÑÓÐ²Ð°Ñ ÑÓÐ»Ñ Ð¸'), + array('kw', 'cor', 'cor', 'cor', 'Cornish', 'Kernewek'), + array('co', 'cos', 'cos', 'cos', 'Corsican', 'corsu, lingua corsa'), + array('cr', 'cre', 'cre', 'cre', 'Cree', 'áá¦ááááá£'), + array('hr', 'hrv', 'hrv', 'hrv', 'Croatian', 'hrvatski jezik'), + array('cs', 'ces', 'cze', 'ces', 'Czech', 'ÄeÅ¡tina, Äeský jazyk'), + array('da', 'dan', 'dan', 'dan', 'Danish', 'dansk'), + array('dv', 'div', 'div', 'div', 'Divehi, Dhivehi, Maldivian', 'ÞÞ¨ÞÞ¬ÞÞ¨'), + array('nl', 'nld', 'dut', 'nld', 'Dutch', 'Nederlands, Vlaams'), + array('dz', 'dzo', 'dzo', 'dzo', 'Dzongkha', 'རྫོà½à¼à½'), + array('en', 'eng', 'eng', 'eng', 'English', 'English'), + array('eo', 'epo', 'epo', 'epo', 'Esperanto', 'Esperanto'), + array('et', 'est', 'est', 'est', 'Estonian', 'eesti, eesti keel'), + array('ee', 'ewe', 'ewe', 'ewe', 'Ewe', 'EÊegbe'), + array('fo', 'fao', 'fao', 'fao', 'Faroese', 'føroyskt'), + array('fj', 'fij', 'fij', 'fij', 'Fijian', 'vosa Vakaviti'), + array('fi', 'fin', 'fin', 'fin', 'Finnish', 'suomi, suomen kieli'), + array('fr', 'fra', 'fre', 'fra', 'French', 'français, langue française'), + array('ff', 'ful', 'ful', 'ful', 'Fula, Fulah, Pulaar, Pular', 'Fulfulde, Pulaar, Pular'), + array('gl', 'glg', 'glg', 'glg', 'Galician', 'galego'), + array('ka', 'kat', 'geo', 'kat', 'Georgian', 'á¥áá áá£áá'), + array('de', 'deu', 'ger', 'deu', 'German', 'Deutsch'), + array('el', 'ell', 'gre', 'ell', 'Greek (modern)', 'ελληνικά'), + array('gn', 'grn', 'grn', 'grn', 'GuaranÃ', 'Avañe\'ẽ'), + array('gu', 'guj', 'guj', 'guj', 'Gujarati', 'àªà«àªàª°àª¾àª¤à«'), + array('ht', 'hat', 'hat', 'hat', 'Haitian, Haitian Creole', 'Kreyòl ayisyen'), + array('ha', 'hau', 'hau', 'hau', 'Hausa', '(Hausa) ÙÙÙÙØ³Ù'), + array('he', 'heb', 'heb', 'heb', 'Hebrew (modern)', '×¢×ר×ת'), + array('hz', 'her', 'her', 'her', 'Herero', 'Otjiherero'), + array('hi', 'hin', 'hin', 'hin', 'Hindi', 'हिनà¥à¤¦à¥, हिà¤à¤¦à¥'), + array('ho', 'hmo', 'hmo', 'hmo', 'Hiri Motu', 'Hiri Motu'), + array('hu', 'hun', 'hun', 'hun', 'Hungarian', 'magyar'), + array('ia', 'ina', 'ina', 'ina', 'Interlingua', 'Interlingua'), + array('id', 'ind', 'ind', 'ind', 'Indonesian', 'Bahasa Indonesia'), + array('ie', 'ile', 'ile', 'ile', 'Interlingue', 'Originally called Occidental; then Interlingue after WWII'), + array('ga', 'gle', 'gle', 'gle', 'Irish', 'Gaeilge'), + array('ig', 'ibo', 'ibo', 'ibo', 'Igbo', 'Asụsụ Igbo'), + array('ik', 'ipk', 'ipk', 'ipk', 'Inupiaq', 'Iñupiaq, Iñupiatun'), + array('io', 'ido', 'ido', 'ido', 'Ido', 'Ido'), + array('is', 'isl', 'ice', 'isl', 'Icelandic', 'Ãslenska'), + array('it', 'ita', 'ita', 'ita', 'Italian', 'italiano'), + array('iu', 'iku', 'iku', 'iku', 'Inuktitut', 'áááááá¦'), + array('ja', 'jpn', 'jpn', 'jpn', 'Japanese', 'æ¥æ¬èª (ã«ã»ãã)'), + array('jv', 'jav', 'jav', 'jav', 'Javanese', 'basa Jawa'), + array('kl', 'kal', 'kal', 'kal', 'Kalaallisut, Greenlandic', 'kalaallisut, kalaallit oqaasii'), + array('kn', 'kan', 'kan', 'kan', 'Kannada', 'à²à²¨à³à²¨à²¡'), + array('kr', 'kau', 'kau', 'kau', 'Kanuri', 'Kanuri'), + array('ks', 'kas', 'kas', 'kas', 'Kashmiri', 'à¤à¤¶à¥à¤®à¥à¤°à¥, ÙØ´Ù ÙØ±Ùâ'), + array('kk', 'kaz', 'kaz', 'kaz', 'Kazakh', 'ÒÐ°Ð·Ð°Ò ÑÑлÑ'), + array('km', 'khm', 'khm', 'khm', 'Khmer', 'ááááá, áááááá¶áá¶, áá¶áá¶ááááá'), + array('ki', 'kik', 'kik', 'kik', 'Kikuyu, Gikuyu', 'GÄ©kÅ©yÅ©'), + array('rw', 'kin', 'kin', 'kin', 'Kinyarwanda', 'Ikinyarwanda'), + array('ky', 'kir', 'kir', 'kir', 'Kyrgyz', 'ÐÑÑгÑзÑа, ÐÑÑгÑз Ñили'), + array('kv', 'kom', 'kom', 'kom', 'Komi', 'коми кÑв'), + array('kg', 'kon', 'kon', 'kon', 'Kongo', 'Kikongo'), + array('ko', 'kor', 'kor', 'kor', 'Korean', 'íêµì´, ì¡°ì ì´'), + array('ku', 'kur', 'kur', 'kur', 'Kurdish', 'Kurdî, ÙÙØ±Ø¯Ûâ'), + array('kj', 'kua', 'kua', 'kua', 'Kwanyama, Kuanyama', 'Kuanyama'), + array('la', 'lat', 'lat', 'lat', 'Latin', 'latine, lingua latina'), + array('', '', '', 'lld', 'Ladin', 'ladin, lingua ladina'), + array('lb', 'ltz', 'ltz', 'ltz', 'Luxembourgish, Letzeburgesch', 'Lëtzebuergesch'), + array('lg', 'lug', 'lug', 'lug', 'Ganda', 'Luganda'), + array('li', 'lim', 'lim', 'lim', 'Limburgish, Limburgan, Limburger', 'Limburgs'), + array('ln', 'lin', 'lin', 'lin', 'Lingala', 'Lingála'), + array('lo', 'lao', 'lao', 'lao', 'Lao', 'àºàº²àºªàº²àº¥àº²àº§'), + array('lt', 'lit', 'lit', 'lit', 'Lithuanian', 'lietuvių kalba'), + array('lu', 'lub', 'lub', 'lub', 'Luba-Katanga', 'Tshiluba'), + array('lv', 'lav', 'lav', 'lav', 'Latvian', 'latvieÅ¡u valoda'), + array('gv', 'glv', 'glv', 'glv', 'Manx', 'Gaelg, Gailck'), + array('mk', 'mkd', 'mac', 'mkd', 'Macedonian', 'македонÑки Ñазик'), + array('mg', 'mlg', 'mlg', 'mlg', 'Malagasy', 'fiteny malagasy'), + array('ms', 'msa', 'may', 'msa', 'Malay', 'bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ'), + array('ml', 'mal', 'mal', 'mal', 'Malayalam', 'മലയാളà´'), + array('mt', 'mlt', 'mlt', 'mlt', 'Maltese', 'Malti'), + array('mi', 'mri', 'mao', 'mri', 'MÄori', 'te reo MÄori'), + array('mr', 'mar', 'mar', 'mar', 'Marathi (MarÄá¹hÄ«)', 'मराठà¥'), + array('mh', 'mah', 'mah', 'mah', 'Marshallese', 'Kajin M̧ajeļ'), + array('mn', 'mon', 'mon', 'mon', 'Mongolian', 'монгол'), + array('na', 'nau', 'nau', 'nau', 'Nauru', 'EkakairÅ© Naoero'), + array('nv', 'nav', 'nav', 'nav', 'Navajo, Navaho', 'Diné bizaad'), + array('nd', 'nde', 'nde', 'nde', 'Northern Ndebele', 'isiNdebele'), + array('ne', 'nep', 'nep', 'nep', 'Nepali', 'नà¥à¤ªà¤¾à¤²à¥'), + array('ng', 'ndo', 'ndo', 'ndo', 'Ndonga', 'Owambo'), + array('nb', 'nob', 'nob', 'nob', 'Norwegian BokmÃ¥l', 'Norsk bokmÃ¥l'), + array('nn', 'nno', 'nno', 'nno', 'Norwegian Nynorsk', 'Norsk nynorsk'), + array('no', 'nor', 'nor', 'nor', 'Norwegian', 'Norsk'), + array('ii', 'iii', 'iii', 'iii', 'Nuosu', 'êê ê¿ Nuosuhxop'), + array('nr', 'nbl', 'nbl', 'nbl', 'Southern Ndebele', 'isiNdebele'), + array('oc', 'oci', 'oci', 'oci', 'Occitan', 'occitan, lenga d\'òc'), + array('oj', 'oji', 'oji', 'oji', 'Ojibwe, Ojibwa', 'ááááá¯á§áá'), + array('cu', 'chu', 'chu', 'chu', 'Old Church Slavonic, Church Slavonic, Old Bulgarian', 'ѩзÑÐºÑ ÑловѣнÑÑкÑ'), + array('om', 'orm', 'orm', 'orm', 'Oromo', 'Afaan Oromoo'), + array('or', 'ori', 'ori', 'ori', 'Oriya', 'à¬à¬¡à¬¼à¬¿à¬'), + array('os', 'oss', 'oss', 'oss', 'Ossetian, Ossetic', 'иÑон æвзаг'), + array('pa', 'pan', 'pan', 'pan', 'Panjabi, Punjabi', 'ਪੰà¨à¨¾à¨¬à©, Ù¾ÙØ¬Ø§Ø¨Ûâ'), + array('pi', 'pli', 'pli', 'pli', 'PÄli', 'पाऴि'), + array('fa', 'fas', 'per', 'fas', 'Persian (Farsi)', 'ÙØ§Ø±Ø³Û'), + array('pl', 'pol', 'pol', 'pol', 'Polish', 'jÄzyk polski, polszczyzna'), + array('ps', 'pus', 'pus', 'pus', 'Pashto, Pushto', 'Ù¾ÚØªÙ'), + array('pt', 'por', 'por', 'por', 'Portuguese', 'português'), + array('qu', 'que', 'que', 'que', 'Quechua', 'Runa Simi, Kichwa'), + array('rm', 'roh', 'roh', 'roh', 'Romansh', 'rumantsch grischun'), + array('rn', 'run', 'run', 'run', 'Kirundi', 'Ikirundi'), + array('ro', 'ron', 'rum', 'ron', 'Romanian', 'limba românÄ'), + array('ru', 'rus', 'rus', 'rus', 'Russian', 'Ð ÑÑÑкий'), + array('sa', 'san', 'san', 'san', 'Sanskrit (Saá¹ská¹ta)', 'सà¤à¤¸à¥à¤à¥à¤¤à¤®à¥'), + array('sc', 'srd', 'srd', 'srd', 'Sardinian', 'sardu'), + array('sd', 'snd', 'snd', 'snd', 'Sindhi', 'सिनà¥à¤§à¥, سÙÚÙØ Ø³ÙØ¯Ú¾Ûâ'), + array('se', 'sme', 'sme', 'sme', 'Northern Sami', 'Davvisámegiella'), + array('sm', 'smo', 'smo', 'smo', 'Samoan', 'gagana fa\'a Samoa'), + array('sg', 'sag', 'sag', 'sag', 'Sango', 'yângâ tî sängö'), + array('sr', 'srp', 'srp', 'srp', 'Serbian', 'ÑÑпÑки Ñезик'), + array('gd', 'gla', 'gla', 'gla', 'Scottish Gaelic, Gaelic', 'Gà idhlig'), + array('sn', 'sna', 'sna', 'sna', 'Shona', 'chiShona'), + array('si', 'sin', 'sin', 'sin', 'Sinhala, Sinhalese', 'à·à·à¶à·à¶½'), + array('sk', 'slk', 'slo', 'slk', 'Slovak', 'slovenÄina, slovenský jazyk'), + array('sl', 'slv', 'slv', 'slv', 'Slovene', 'slovenski jezik, slovenÅ¡Äina'), + array('so', 'som', 'som', 'som', 'Somali', 'Soomaaliga, af Soomaali'), + array('st', 'sot', 'sot', 'sot', 'Southern Sotho', 'Sesotho'), + array('es', 'spa', 'spa', 'spa', 'Spanish', 'español'), + array('su', 'sun', 'sun', 'sun', 'Sundanese', 'Basa Sunda'), + array('sw', 'swa', 'swa', 'swa', 'Swahili', 'Kiswahili'), + array('ss', 'ssw', 'ssw', 'ssw', 'Swati', 'SiSwati'), + array('sv', 'swe', 'swe', 'swe', 'Swedish', 'svenska'), + array('ta', 'tam', 'tam', 'tam', 'Tamil', 'தமிழà¯'), + array('te', 'tel', 'tel', 'tel', 'Telugu', 'à°¤à±à°²à±à°à±'), + array('tg', 'tgk', 'tgk', 'tgk', 'Tajik', 'Ñоҷикӣ, toçikÄ«, تاجÛÚ©Ûâ'), + array('th', 'tha', 'tha', 'tha', 'Thai', 'à¹à¸à¸¢'), + array('ti', 'tir', 'tir', 'tir', 'Tigrinya', 'áµááá'), + array('bo', 'bod', 'tib', 'bod', 'Tibetan Standard, Tibetan, Central', 'à½à½¼à½à¼à½¡à½²à½'), + array('tk', 'tuk', 'tuk', 'tuk', 'Turkmen', 'Türkmen, ТүÑкмен'), + array('tl', 'tgl', 'tgl', 'tgl', 'Tagalog', 'Wikang Tagalog, áááá á áááááá'), + array('tn', 'tsn', 'tsn', 'tsn', 'Tswana', 'Setswana'), + array('to', 'ton', 'ton', 'ton', 'Tonga (Tonga Islands)', 'faka Tonga'), + array('tr', 'tur', 'tur', 'tur', 'Turkish', 'Türkçe'), + array('ts', 'tso', 'tso', 'tso', 'Tsonga', 'Xitsonga'), + array('tt', 'tat', 'tat', 'tat', 'Tatar', 'ÑаÑÐ°Ñ Ñеле, tatar tele'), + array('tw', 'twi', 'twi', 'twi', 'Twi', 'Twi'), + array('ty', 'tah', 'tah', 'tah', 'Tahitian', 'Reo Tahiti'), + array('ug', 'uig', 'uig', 'uig', 'Uyghur', 'ئÛÙØºÛرÚÛâ, Uyghurche'), + array('uk', 'ukr', 'ukr', 'ukr', 'Ukrainian', 'ÑкÑаÑнÑÑка мова'), + array('ur', 'urd', 'urd', 'urd', 'Urdu', 'اردÙ'), + array('uz', 'uzb', 'uzb', 'uzb', 'Uzbek', 'OÊ»zbek, Ðзбек, Ø£ÛØ²Ø¨ÛÙâ'), + array('ve', 'ven', 'ven', 'ven', 'Venda', 'Tshivená¸a'), + array('vi', 'vie', 'vie', 'vie', 'Vietnamese', 'Viá»t Nam'), + array('vo', 'vol', 'vol', 'vol', 'Volapük', 'Volapük'), + array('wa', 'wln', 'wln', 'wln', 'Walloon', 'walon'), + array('cy', 'cym', 'wel', 'cym', 'Welsh', 'Cymraeg'), + array('wo', 'wol', 'wol', 'wol', 'Wolof', 'Wollof'), + array('fy', 'fry', 'fry', 'fry', 'Western Frisian', 'Frysk'), + array('xh', 'xho', 'xho', 'xho', 'Xhosa', 'isiXhosa'), + array('yi', 'yid', 'yid', 'yid', 'Yiddish', '××Ö´××ש'), + array('yo', 'yor', 'yor', 'yor', 'Yoruba', 'Yorùbá'), + array('za', 'zha', 'zha', 'zha', 'Zhuang, Chuang', 'Saɯ cueÅÆ , Saw cuengh'), + array('zu', 'zul', 'zul', 'zul', 'Zulu', 'isiZulu'), + ); + + /* + * Get all language data + * + * @return (array) + */ + public function allLanguages() + { + return $this->languages; + } + + /* + * Get language name from ISO-639-1 (two-letters code) + * + * @return (string) + */ + public function languageByCode1($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[0] == $code) { + $result = $lang[4]; + break; + } + } + + return $result; + } + + /* + * Get native language name from ISO-639-1 (two-letters code) + * + * @return (string) + */ + public function nativeByCode1($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[0] == $code) { + $result = $lang[5]; + break; + } + } + + return $result; + } + + /* + * Get language name from ISO-639-2/t (three-letter codes) terminologic + * + * @return (string) + */ + public function languageByCode2t($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[1] == $code) { + $result = $lang[4]; + break; + } + } + + return $result; + } + + /* + * Get native language name from ISO-639-2/t (three-letter codes) terminologic + * + * @return (string) + */ + public function nativeByCode2t($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[1] == $code) { + $result = $lang[5]; + break; + } + } + + return $result; + } + + /* + * Get language name from ISO-639-2/b (three-letter codes) bibliographic + * + * @return (string) + */ + public function languageByCode2b($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[2] == $code) { + $result = $lang[4]; + break; + } + } + + return $result; + } + + /* + * Get native language name from ISO-639-2/b (three-letter codes) bibliographic + * + * @return (string) + */ + public function nativeByCode2b($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[2] == $code) { + $result = $lang[5]; + break; + } + } + + return $result; + } + + /* + * Get language name from ISO-639-3 (three-letter codes) + * + * @return (string) + */ + public function languageByCode3($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[3] == $code) { + $result = $lang[4]; + break; + } + } + + return $result; + } + + /* + * Get native language name from ISO-639-3 (three-letter codes) + * + * @return (string) + */ + public function nativeByCode3($code) + { + $code = strtolower($code); + + $result = ''; + + foreach ($this->languages as $lang) { + if ($lang[3] == $code) { + $result = $lang[5]; + break; + } + } + + return $result; + } + + /* + * Get ISO-639-1 (two-letters code) from language name + * + * @return (string) + */ + public function code1ByLanguage($language) + { + $language_key = ucwords(strtolower($language)); + + $result = ''; + + foreach ($this->languages as $lang) { + if (in_array($language_key, explode(', ', $lang[4]))) { + $result = $lang[0]; + break; + } + } + + return $result; + } + + /* + * Get ISO-639-2/t (three-letter codes) terminologic from language name + * + * @return (string) + */ + public function code2tByLanguage($language) + { + $language_key = ucwords(strtolower($language)); + + $result = ''; + + foreach ($this->languages as $lang) { + if (in_array($language_key, explode(', ', $lang[4]))) { + $result = $lang[1]; + break; + } + } + + return $result; + } + + /* + * Get ISO-639-2/b (three-letter codes) bibliographic from language name + * + * @return (string) + */ + public function code2bByLanguage($language) + { + $language_key = ucwords(strtolower($language)); + + $result = ''; + + foreach ($this->languages as $lang) { + if (in_array($language_key, explode(', ', $lang[4]))) { + $result = $lang[2]; + break; + } + } + + return $result; + } + + /* + * Get ISO-639-3 (three-letter codes) from language name + * + * @return (string) + */ + public function code3ByLanguage($language) + { + $language_key = ucwords(strtolower($language)); + + $result = ''; + + foreach ($this->languages as $lang) { + if (in_array($language_key, explode(', ', $lang[4]))) { + $result = $lang[3]; + break; + } + } + + return $result; + } +} diff --git a/langfilter/vendor/matriphe/iso-639/tests/ISO639Test.php b/langfilter/vendor/matriphe/iso-639/tests/ISO639Test.php new file mode 100644 index 00000000..b4f22ed7 --- /dev/null +++ b/langfilter/vendor/matriphe/iso-639/tests/ISO639Test.php @@ -0,0 +1,239 @@ +<?php + +use Matriphe\ISO639\ISO639; + +class ISO639Test extends PHPUnit_Framework_TestCase +{ + public function __construct() + { + $this->iso = new ISO639(); + } + + public function testLanguageISO6391() + { + $this->assertSame('English', $this->iso->languageByCode1('en')); + $this->assertSame('French', $this->iso->languageByCode1('fr')); + $this->assertSame('Spanish', $this->iso->languageByCode1('es')); + $this->assertSame('Indonesian', $this->iso->languageByCode1('id')); + $this->assertSame('Javanese', $this->iso->languageByCode1('jv')); + $this->assertSame('Hindi', $this->iso->languageByCode1('hi')); + $this->assertSame('Thai', $this->iso->languageByCode1('th')); + $this->assertSame('Korean', $this->iso->languageByCode1('ko')); + $this->assertSame('Japanese', $this->iso->languageByCode1('ja')); + $this->assertSame('Chinese', $this->iso->languageByCode1('zh')); + $this->assertSame('Russian', $this->iso->languageByCode1('ru')); + $this->assertSame('Arabic', $this->iso->languageByCode1('ar')); + $this->assertSame('Vietnamese', $this->iso->languageByCode1('vi')); + $this->assertSame('Malay', $this->iso->languageByCode1('ms')); + $this->assertSame('Sundanese', $this->iso->languageByCode1('su')); + } + + public function testNativeISO6391() + { + $this->assertSame('English', $this->iso->nativeByCode1('en')); + $this->assertSame('français, langue française', $this->iso->nativeByCode1('fr')); + $this->assertSame('español', $this->iso->nativeByCode1('es')); + $this->assertSame('Bahasa Indonesia', $this->iso->nativeByCode1('id')); + $this->assertSame('basa Jawa', $this->iso->nativeByCode1('jv')); + $this->assertSame('हिनà¥à¤¦à¥, हिà¤à¤¦à¥', $this->iso->nativeByCode1('hi')); + $this->assertSame('à¹à¸à¸¢', $this->iso->nativeByCode1('th')); + $this->assertSame('íêµì´, ì¡°ì ì´', $this->iso->nativeByCode1('ko')); + $this->assertSame('æ¥æ¬èª (ã«ã»ãã)', $this->iso->nativeByCode1('ja')); + $this->assertSame('䏿 (ZhÅngwén), æ±è¯, æ¼¢èª', $this->iso->nativeByCode1('zh')); + $this->assertSame('Ð ÑÑÑкий', $this->iso->nativeByCode1('ru')); + $this->assertSame('Ø§ÙØ¹Ø±Ø¨ÙØ©', $this->iso->nativeByCode1('ar')); + $this->assertSame('Viá»t Nam', $this->iso->nativeByCode1('vi')); + $this->assertSame('bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ', $this->iso->nativeByCode1('ms')); + $this->assertSame('Basa Sunda', $this->iso->nativeByCode1('su')); + } + + public function testLanguageISO6392t() + { + $this->assertSame('English', $this->iso->languageByCode2t('eng')); + $this->assertSame('French', $this->iso->languageByCode2t('fra')); + $this->assertSame('Spanish', $this->iso->languageByCode2t('spa')); + $this->assertSame('Indonesian', $this->iso->languageByCode2t('ind')); + $this->assertSame('Javanese', $this->iso->languageByCode2t('jav')); + $this->assertSame('Hindi', $this->iso->languageByCode2t('hin')); + $this->assertSame('Thai', $this->iso->languageByCode2t('tha')); + $this->assertSame('Korean', $this->iso->languageByCode2t('kor')); + $this->assertSame('Japanese', $this->iso->languageByCode2t('jpn')); + $this->assertSame('Chinese', $this->iso->languageByCode2t('zho')); + $this->assertSame('Russian', $this->iso->languageByCode2t('rus')); + $this->assertSame('Arabic', $this->iso->languageByCode2t('ara')); + $this->assertSame('Vietnamese', $this->iso->languageByCode2t('vie')); + $this->assertSame('Malay', $this->iso->languageByCode2t('msa')); + $this->assertSame('Sundanese', $this->iso->languageByCode2t('sun')); + } + + public function testNativeISO6392t() + { + $this->assertSame('English', $this->iso->nativeByCode2t('eng')); + $this->assertSame('français, langue française', $this->iso->nativeByCode2t('fra')); + $this->assertSame('español', $this->iso->nativeByCode2t('spa')); + $this->assertSame('Bahasa Indonesia', $this->iso->nativeByCode2t('ind')); + $this->assertSame('basa Jawa', $this->iso->nativeByCode2t('jav')); + $this->assertSame('हिनà¥à¤¦à¥, हिà¤à¤¦à¥', $this->iso->nativeByCode2t('hin')); + $this->assertSame('à¹à¸à¸¢', $this->iso->nativeByCode2t('tha')); + $this->assertSame('íêµì´, ì¡°ì ì´', $this->iso->nativeByCode2t('kor')); + $this->assertSame('æ¥æ¬èª (ã«ã»ãã)', $this->iso->nativeByCode2t('jpn')); + $this->assertSame('䏿 (ZhÅngwén), æ±è¯, æ¼¢èª', $this->iso->nativeByCode2t('zho')); + $this->assertSame('Ð ÑÑÑкий', $this->iso->nativeByCode2t('rus')); + $this->assertSame('Ø§ÙØ¹Ø±Ø¨ÙØ©', $this->iso->nativeByCode2t('ara')); + $this->assertSame('Viá»t Nam', $this->iso->nativeByCode2t('vie')); + $this->assertSame('bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ', $this->iso->nativeByCode2t('msa')); + $this->assertSame('Basa Sunda', $this->iso->nativeByCode2t('sun')); + } + + public function testLanguageISO6392b() + { + $this->assertSame('English', $this->iso->languageByCode2b('eng')); + $this->assertSame('French', $this->iso->languageByCode2b('fre')); + $this->assertSame('Spanish', $this->iso->languageByCode2b('spa')); + $this->assertSame('Indonesian', $this->iso->languageByCode2b('ind')); + $this->assertSame('Javanese', $this->iso->languageByCode2b('jav')); + $this->assertSame('Hindi', $this->iso->languageByCode2b('hin')); + $this->assertSame('Thai', $this->iso->languageByCode2b('tha')); + $this->assertSame('Korean', $this->iso->languageByCode2b('kor')); + $this->assertSame('Japanese', $this->iso->languageByCode2b('jpn')); + $this->assertSame('Chinese', $this->iso->languageByCode2b('chi')); + $this->assertSame('Russian', $this->iso->languageByCode2b('rus')); + $this->assertSame('Arabic', $this->iso->languageByCode2b('ara')); + $this->assertSame('Vietnamese', $this->iso->languageByCode2b('vie')); + $this->assertSame('Malay', $this->iso->languageByCode2b('may')); + $this->assertSame('Sundanese', $this->iso->languageByCode2b('sun')); + } + + public function testNativeISO6392b() + { + $this->assertSame('English', $this->iso->nativeByCode2b('eng')); + $this->assertSame('français, langue française', $this->iso->nativeByCode2b('fre')); + $this->assertSame('español', $this->iso->nativeByCode2b('spa')); + $this->assertSame('Bahasa Indonesia', $this->iso->nativeByCode2b('ind')); + $this->assertSame('basa Jawa', $this->iso->nativeByCode2b('jav')); + $this->assertSame('हिनà¥à¤¦à¥, हिà¤à¤¦à¥', $this->iso->nativeByCode2b('hin')); + $this->assertSame('à¹à¸à¸¢', $this->iso->nativeByCode2b('tha')); + $this->assertSame('íêµì´, ì¡°ì ì´', $this->iso->nativeByCode2b('kor')); + $this->assertSame('æ¥æ¬èª (ã«ã»ãã)', $this->iso->nativeByCode2b('jpn')); + $this->assertSame('䏿 (ZhÅngwén), æ±è¯, æ¼¢èª', $this->iso->nativeByCode2b('chi')); + $this->assertSame('Ð ÑÑÑкий', $this->iso->nativeByCode2b('rus')); + $this->assertSame('Ø§ÙØ¹Ø±Ø¨ÙØ©', $this->iso->nativeByCode2b('ara')); + $this->assertSame('Viá»t Nam', $this->iso->nativeByCode2b('vie')); + $this->assertSame('bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ', $this->iso->nativeByCode2b('may')); + $this->assertSame('Basa Sunda', $this->iso->nativeByCode2b('sun')); + } + + public function testLanguageISO6393() + { + $this->assertSame('English', $this->iso->languageByCode3('eng')); + $this->assertSame('French', $this->iso->languageByCode3('fra')); + $this->assertSame('Spanish', $this->iso->languageByCode3('spa')); + $this->assertSame('Indonesian', $this->iso->languageByCode3('ind')); + $this->assertSame('Javanese', $this->iso->languageByCode3('jav')); + $this->assertSame('Hindi', $this->iso->languageByCode3('hin')); + $this->assertSame('Thai', $this->iso->languageByCode3('tha')); + $this->assertSame('Korean', $this->iso->languageByCode3('kor')); + $this->assertSame('Japanese', $this->iso->languageByCode3('jpn')); + $this->assertSame('Chinese', $this->iso->languageByCode3('zho')); + $this->assertSame('Russian', $this->iso->languageByCode3('rus')); + $this->assertSame('Arabic', $this->iso->languageByCode3('ara')); + $this->assertSame('Vietnamese', $this->iso->languageByCode3('vie')); + $this->assertSame('Malay', $this->iso->languageByCode3('msa')); + $this->assertSame('Sundanese', $this->iso->languageByCode3('sun')); + } + + public function testNativeISO6393() + { + $this->assertSame('English', $this->iso->nativeByCode3('eng')); + $this->assertSame('français, langue française', $this->iso->nativeByCode3('fra')); + $this->assertSame('español', $this->iso->nativeByCode3('spa')); + $this->assertSame('Bahasa Indonesia', $this->iso->nativeByCode3('ind')); + $this->assertSame('basa Jawa', $this->iso->nativeByCode3('jav')); + $this->assertSame('हिनà¥à¤¦à¥, हिà¤à¤¦à¥', $this->iso->nativeByCode3('hin')); + $this->assertSame('à¹à¸à¸¢', $this->iso->nativeByCode3('tha')); + $this->assertSame('íêµì´, ì¡°ì ì´', $this->iso->nativeByCode3('kor')); + $this->assertSame('æ¥æ¬èª (ã«ã»ãã)', $this->iso->nativeByCode3('jpn')); + $this->assertSame('䏿 (ZhÅngwén), æ±è¯, æ¼¢èª', $this->iso->nativeByCode3('zho')); + $this->assertSame('Ð ÑÑÑкий', $this->iso->nativeByCode3('rus')); + $this->assertSame('Ø§ÙØ¹Ø±Ø¨ÙØ©', $this->iso->nativeByCode3('ara')); + $this->assertSame('Viá»t Nam', $this->iso->nativeByCode3('vie')); + $this->assertSame('bahasa Melayu, Ø¨ÙØ§Ø³ Ù ÙØ§ÙÙâ', $this->iso->nativeByCode3('msa')); + $this->assertSame('Basa Sunda', $this->iso->nativeByCode3('sun')); + } + + public function testISO6391Language() + { + $this->assertSame('en', $this->iso->code1ByLanguage('English')); + $this->assertSame('fr', $this->iso->code1ByLanguage('French')); + $this->assertSame('es', $this->iso->code1ByLanguage('Spanish')); + $this->assertSame('id', $this->iso->code1ByLanguage('Indonesian')); + $this->assertSame('jv', $this->iso->code1ByLanguage('Javanese')); + $this->assertSame('hi', $this->iso->code1ByLanguage('Hindi')); + $this->assertSame('th', $this->iso->code1ByLanguage('Thai')); + $this->assertSame('ko', $this->iso->code1ByLanguage('Korean')); + $this->assertSame('ja', $this->iso->code1ByLanguage('Japanese')); + $this->assertSame('zh', $this->iso->code1ByLanguage('Chinese')); + $this->assertSame('ru', $this->iso->code1ByLanguage('Russian')); + $this->assertSame('ar', $this->iso->code1ByLanguage('Arabic')); + $this->assertSame('vi', $this->iso->code1ByLanguage('Vietnamese')); + $this->assertSame('ms', $this->iso->code1ByLanguage('Malay')); + $this->assertSame('su', $this->iso->code1ByLanguage('Sundanese')); + } + + public function testISO6392tLanguage() + { + $this->assertSame('eng', $this->iso->code2tByLanguage('English')); + $this->assertSame('fra', $this->iso->code2tByLanguage('French')); + $this->assertSame('spa', $this->iso->code2tByLanguage('Spanish')); + $this->assertSame('ind', $this->iso->code2tByLanguage('Indonesian')); + $this->assertSame('jav', $this->iso->code2tByLanguage('Javanese')); + $this->assertSame('hin', $this->iso->code2tByLanguage('Hindi')); + $this->assertSame('tha', $this->iso->code2tByLanguage('Thai')); + $this->assertSame('kor', $this->iso->code2tByLanguage('Korean')); + $this->assertSame('jpn', $this->iso->code2tByLanguage('Japanese')); + $this->assertSame('zho', $this->iso->code2tByLanguage('Chinese')); + $this->assertSame('rus', $this->iso->code2tByLanguage('Russian')); + $this->assertSame('ara', $this->iso->code2tByLanguage('Arabic')); + $this->assertSame('vie', $this->iso->code2tByLanguage('Vietnamese')); + $this->assertSame('msa', $this->iso->code2tByLanguage('Malay')); + $this->assertSame('sun', $this->iso->code2tByLanguage('Sundanese')); + } + + public function testISO6392bLanguage() + { + $this->assertSame('eng', $this->iso->code2bByLanguage('English')); + $this->assertSame('fre', $this->iso->code2bByLanguage('French')); + $this->assertSame('spa', $this->iso->code2bByLanguage('Spanish')); + $this->assertSame('ind', $this->iso->code2bByLanguage('Indonesian')); + $this->assertSame('jav', $this->iso->code2bByLanguage('Javanese')); + $this->assertSame('hin', $this->iso->code2bByLanguage('Hindi')); + $this->assertSame('tha', $this->iso->code2bByLanguage('Thai')); + $this->assertSame('kor', $this->iso->code2bByLanguage('Korean')); + $this->assertSame('jpn', $this->iso->code2bByLanguage('Japanese')); + $this->assertSame('chi', $this->iso->code2bByLanguage('Chinese')); + $this->assertSame('rus', $this->iso->code2bByLanguage('Russian')); + $this->assertSame('ara', $this->iso->code2bByLanguage('Arabic')); + $this->assertSame('vie', $this->iso->code2bByLanguage('Vietnamese')); + $this->assertSame('may', $this->iso->code2bByLanguage('Malay')); + $this->assertSame('sun', $this->iso->code2bByLanguage('Sundanese')); + } + + public function testISO6393Language() + { + $this->assertSame('eng', $this->iso->code3ByLanguage('English')); + $this->assertSame('fra', $this->iso->code3ByLanguage('French')); + $this->assertSame('spa', $this->iso->code3ByLanguage('Spanish')); + $this->assertSame('ind', $this->iso->code3ByLanguage('Indonesian')); + $this->assertSame('jav', $this->iso->code3ByLanguage('Javanese')); + $this->assertSame('hin', $this->iso->code3ByLanguage('Hindi')); + $this->assertSame('tha', $this->iso->code3ByLanguage('Thai')); + $this->assertSame('kor', $this->iso->code3ByLanguage('Korean')); + $this->assertSame('jpn', $this->iso->code3ByLanguage('Japanese')); + $this->assertSame('zho', $this->iso->code3ByLanguage('Chinese')); + $this->assertSame('rus', $this->iso->code3ByLanguage('Russian')); + $this->assertSame('ara', $this->iso->code3ByLanguage('Arabic')); + $this->assertSame('vie', $this->iso->code3ByLanguage('Vietnamese')); + $this->assertSame('msa', $this->iso->code3ByLanguage('Malay')); + $this->assertSame('sun', $this->iso->code3ByLanguage('Sundanese')); + } +}