• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/import/csv.php
  • Класс: BitrixTranslateControllerImportCsv
  • Вызов: Csv::importAction
public function importAction(): array
{
	$action = new TranslateControllerImportImportCsv(
		self::ACTION_IMPORT,
		$this,
		[
			'tabId' => $this->tabId,
			'encodingIn' => $this->encodingIn,
			'updateMethod' => $this->updateMethod,
			'csvFilePath' => $this->csvFilePath,
		]
	);

	$result = $action->run(true);

	if (count($action->getErrors()) > 0)
	{
		$this->addErrors($action->getErrors());
	}

	if ($action instanceof TranslateControllerITimeLimit)
	{
		if ($action->hasProcessCompleted() && $result['TOTAL_ITEMS'] == 0)
		{
			$result['SUMMARY'] = Loc::getMessage('TR_IMPORT_VOID');
		}
		else
		{
			$messagePlaceholders = [
				'#TOTAL_PHRASES#' => $result['TOTAL_ITEMS'],
				'#PROCESSED_PHRASES#' => $result['PROCESSED_ITEMS'],
			];
			if ($action->hasProcessCompleted())
			{
				$result['SUMMARY'] =
					Loc::getMessage('TR_IMPORT_COMPLETED')."n".
					Loc::getMessage('TR_IMPORT_ACTION_STATS', $messagePlaceholders);
			}
			else
			{
				$result['SUMMARY'] = Loc::getMessage('TR_IMPORT_ACTION_STATS', $messagePlaceholders);
			}
		}
	}
	else
	{
		if ($result['TOTAL_ITEMS'] == 0)
		{
			$result['SUMMARY'] = Loc::getMessage('TR_IMPORT_VOID');
		}
		else
		{
			$messagePlaceholders = [
				'#TOTAL_PHRASES#' => $result['TOTAL_ITEMS'],
				'#PROCESSED_PHRASES#' => $result['PROCESSED_ITEMS'],
			];

			$result['SUMMARY'] =
				Loc::getMessage('TR_IMPORT_COMPLETED')."n".
				Loc::getMessage('TR_IMPORT_ACTION_STATS', $messagePlaceholders);
		}
	}

	return $result;
}