protected function install_language_pack($langcode) {

        // initialise new component installer to process this language
        $installer = new component_installer('https://download.moodle.org', 'download.php/direct/langpack/' . $this->version,
            $langcode . '.zip', 'languages.md5', 'lang');

        if (!$installer->requisitesok) {
            throw new lang_installer_exception('installer_requisites_check_failed');
        }

        $status = $installer->install();

        if ($status == COMPONENT_ERROR) {
            if ($installer->get_error() === 'remotedownloaderror') {
                return self::RESULT_DOWNLOADERROR;
            } else {
                throw new lang_installer_exception($installer->get_error(), $langcode);
            }

        } else if ($status == COMPONENT_UPTODATE) {
            return self::RESULT_UPTODATE;

        } else if ($status == COMPONENT_INSTALLED) {
            return self::RESULT_INSTALLED;

        } else {
            throw new lang_installer_exception('unexpected_installer_result', $status);
        }
    }
protected function install_language_pack($langcode) {

        // initialise new component installer to process this language
        $installer = new component_installer('https://download.moodle.org', 'download.php/direct/langpack/' . $this->version,
            $langcode . '.zip', 'languages.md5', 'lang');

        if (!$installer->requisitesok) {
            throw new lang_installer_exception('installer_requisites_check_failed');
        }

        $status = $installer->install();

        if ($status == COMPONENT_ERROR) {
            if ($installer->get_error() === 'remotedownloaderror') {
                return self::RESULT_DOWNLOADERROR;
            } else {
                throw new lang_installer_exception($installer->get_error(), $langcode);
            }

        } else if ($status == COMPONENT_UPTODATE) {
            return self::RESULT_UPTODATE;

        } else if ($status == COMPONENT_INSTALLED) {
            return self::RESULT_INSTALLED;

        } else {
            throw new lang_installer_exception('unexpected_installer_result', $status);
        }
    }
protected function install_language_pack ( $ langcode ) { // initialise new component installer to process this language $ installer = new component_installer ( 'https://download.moodle.org' , 'download.php/direct/langpack/' . $ this -> version , $ langcode . '.zip' , 'languages.md5' , 'lang' ) ; if ( ! $ installer -> requisitesok ) { throw new lang_installer_exception ( 'installer_requisites_check_failed' ) ; } $ status = $ installer -> install ( ) ; if ( $ status == COMPONENT_ERROR ) { if ( $ installer -> get_error ( ) === 'remotedownloaderror' ) { return self :: RESULT_DOWNLOADERROR ; } else { throw new lang_installer_exception ( $ installer -> get_error ( ) , $ langcode ) ; } } else if ( $ status == COMPONENT_UPTODATE ) { return self :: RESULT_UPTODATE ; } else if ( $ status == COMPONENT_INSTALLED ) { return self :: RESULT_INSTALLED ; } else { throw new lang_installer_exception ( 'unexpected_installer_result' , $ status ) ; } }
Perform the actual language pack installation

@uses component_installer
@param string $langcode
@return int return status
Perform the actual language pack installation