Задает языковые параметры для hl блока.

@param int   $hlId  Идентификатор блока
@param array $langs Массив переводов

@throws \marvin255\bxmigrate\migrate\Exception
199450
protected function HLSetLangs($hlId, array $langs)
    {
        $hlId = (int) $hlId;
        if (!$hlId) {
            throw new Exception('Empty Hl id for langs');
        }

        $res = HighloadBlockLangTable::getList([
            'filter' => ['ID' => $hlId],
        ]);
        while ($loc = $res->fetch()) {
            HighloadBlockLangTable::delete($loc['ID']);
        }

        foreach ($langs as $langId => $langValue) {
            $langRes = HighloadBlockLangTable::add([
                'ID' => $hlId,
                'LID' => $langId,
                'NAME' => $langValue,
            ]);
            if (!$langRes->isSuccess()) {
                throw new Exception("Can't create lang {$langId} for {$hlId} highload block: " . implode(', ', $langRes->getErrorMessages()));
            }
        }
    }
895320
public function uninstall_language($lang) {
        global $CFG;

        $dest1 = $CFG->dataroot.'/lang/'.$lang;
        $dest2 = $CFG->dirroot.'/lang/'.$lang;
        $rm1 = false;
        $rm2 = false;
        if (file_exists($dest1)) {
            $rm1 = remove_dir($dest1);
        }
        if (file_exists($dest2)) {
            $rm2 = remove_dir($dest2);
        }

        if ($rm1 or $rm2) {
            $this->info[] = get_string('langpackremoved', 'tool_langimport', $lang);
            event\langpack_removed::event_with_langcode($lang)->trigger();
            return true;
        } else {    // Nothing deleted, possibly due to permission error.
            $this->errors[] = get_string('langpacknotremoved', 'tool_langimport', $lang);
            return false;
        }
    }
657271
protected function delete($langId, $area, array $list)
    {
        return $this->translationRespository->deleteByCollection($langId, $area, $list);
    }
53205
public function setLang( $lang ) {
		if ( !IntuitionUtil::nonEmptyStr( $lang ) ) {
			return false;
		}
		$this->currentLanguage = $this->normalizeLang( $lang );
		return true;
	}
815612
public function uncheck($migration)
    {
        if ($this->isChecked($migration)) {
            $checked = $this->getChecked();
            $class = $this->compileEntity();
            $result = $class::delete($checked[$migration]['ID']);
            if (!$result->isSuccess()) {
                throw new Exception(
                    "Can't delete migration in HL "
                    . implode(', ', $result->getErrorMessages())
                );
            }
        }
    }
1153112
public function setLanguage($lang = null)
    {
        $this->_iLanguage = (int) $lang;
        // reset
        $this->_sViewTable = false;
    }
361594
public function updateLanguage(Language $language)
    {
        try {
            return $this->innerGateway->updateLanguage($language);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
204827
public function setHomeLanguage($home_language)
    {
        $allowedValues = $this->getHomeLanguageAllowableValues();
        if (!is_null($home_language) && !in_array($home_language, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'home_language', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['home_language'] = $home_language;

        return $this;
    }
197757
protected function _validateLanguageCode($langCode)
    {
        if (!$this->_langHelper->validateLanguageCode($langCode)) {
            throw Mage::exception('Radial_Core', $this->_coreHelper->__(self::INVALID_LANGUAGE_CODE_MESSAGE));
        }
        return $this;
    }
71678
public function delete($lang, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Tags', 'delete')) {
            return $this->noPermission();
        }

        $tagDeleteRes = $this->deleteTag($id);
        if(gettype($tagDeleteRes) == "boolean") {
            if($tagDeleteRes) {
                return $this->response('Tag is successfully deleted');
            }
        }else{
            return $tagDeleteRes;
        }
        return $this->response('Tag could not be deleted. Please try again later or contact your Administrator!', 500);
    }
694715
public function add()
    {
        $result = HighloadBlockTable::add($this->getFieldsWithDefault());

        if (!$result->isSuccess()) {
            throw new \Exception(join(', ', $result->getErrorMessages()));
        }

        foreach ($this->lang as $lid => $name) {
            HighloadBlockLangTable::add([
                "ID" => $result->getId(),
                "LID" => $lid,
                "NAME" => $name
            ]);
        }

        Logger::log("Добавлен HL {$this->fields['NAME']}", Logger::COLOR_GREEN);

        return $result->getId();
    }
777649
public function setLanguage(string $lang): void
    {
        if (!is_string($lang) || empty($lang)) {
            throw new \InvalidArgumentException("Invalid language $lang");
        }
        
        $this->lang = $lang;
    }
394897
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);
        }
    }
1044921
public function alias($lang, $aliases)
    {
        $lang = strtolower($lang);

        if (!is_array($aliases)) {
            $aliases = [$aliases];
        }

        $aliases = array_map('strtolower', $aliases);

        $this->aliases[$lang] = array_unique(
            array_merge(Arr::get($this->aliases, $lang, []), $aliases)
        );

        return $this;
    }
512093
protected function _addLanguage( MW_Container_Content_Interface $contentItem, $langid, array $ids )
	{
		$manager = MShop_Product_Manager_Factory::createManager( $this->_getContext() );
		$search = $manager->createSearch();

		if( !empty( $ids ) ) {
			$search->setConditions( $search->compare( '==', 'product.id', $ids ) );
		}

		$sort = array( $search->sort( '+', 'product.code' ) );
		$search->setSortations( $sort );

		$start = 0;

		do
		{
			$result = $manager->searchItems( $search, array('text') );

			foreach( $result as $item ) {
				$this->_addItem( $contentItem, $item, $langid );
			}

			$count = count( $result );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count == $search->getSliceSize() );
	}
844493
public function handleModel(Basic $model, $lang = null)
    {
        // Handle links to static items
        $items = $model->getSitemapItems($lang);
        if (is_array($items)) {
            // Foreach static model content
            foreach ($items as $item) {
                /* @var $item Basic|GoogleImage|GoogleAlternateLang|ActiveRecord */
                $this->handleItem($item, $lang);
            }
        }

        // Search models in db
        $query = $model->getSitemapItemsQuery($lang);
        if ($query instanceof \yii\db\Query) {
            // Foreach batch models
            $batchSize = static::getModelBatchSize($model);
            foreach ($query->each($batchSize) as $item) {
                /* @var $item Basic|GoogleImage|GoogleAlternateLang|ActiveRecord */
                $this->handleItem($item, $lang);
            }
        }
    }
944050
public function delete($lang, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Permissions', 'delete')) {
            return $this->noPermission();
        }

        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        $group = \App\Models\UserGroup::find($id)->delete();
        if($group) {
            DB::table('permissions')->where('groupID', $id)->delete();
            $result = $this->response('Group is deleted');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }