Aleksander Machniak
2016-01-16 ed1d212ae2daea5e4bd043417610177093e99f19
program/lib/Roundcube/rcube_spellcheck_pspell.php
@@ -1,6 +1,6 @@
<?php
/*
/**
 +-----------------------------------------------------------------------+
 | This file is part of the Roundcube Webmail client                     |
 |                                                                       |
@@ -28,6 +28,35 @@
{
    private $plink;
    private $matches = array();
    /**
     * Return a list of languages supported by this backend
     *
     * @see rcube_spellcheck_engine::languages()
     */
    function languages()
    {
        $defaults = array('en');
        $langs = array();
        // get aspell dictionaries
        exec('aspell dump dicts', $dicts);
        if (!empty($dicts)) {
            $seen = array();
            foreach ($dicts as $lang) {
                $lang = preg_replace('/-.*$/', '', $lang);
                $langc = strlen($lang) == 2 ? $lang.'_'.strtoupper($lang) : $lang;
                if (!$seen[$langc]++)
                    $langs[] = $lang;
            }
            $langs = array_unique($langs);
        }
        else {
            $langs = $defaults;
        }
        return $langs;
    }
    /**
     * Initializes PSpell dictionary
@@ -155,6 +184,4 @@
        return $result;
    }
}