• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/asset/collect.php
  • Класс: BitrixTranslateControllerAssetCollect
  • Вызов: Collect::lookThroughLangFolder
private function lookThroughLangFolder($langFolderRelPath)
{
	$files = [];
	$folders = [];

	$langFolderFullPath = TranslateIOPath::tidy(self::$documentRoot.'/'.$langFolderRelPath);

	$storeFolderRelPath = str_replace(Grabber::START_PATH, '', $langFolderRelPath);

	if (self::$useTranslationRepository && in_array($this->languageId, self::$translationRepositoryLanguages))
	{
		$langFolderFullPath = MainLocalizationTranslation::convertLangPath($langFolderFullPath, $this->languageId);
	}

	$childrenList = TranslateIOFileSystemHelper::getFileList($langFolderFullPath);
	if (!empty($childrenList))
	{
		foreach ($childrenList as $fullPath)
		{
			$name = basename($fullPath);
			if (in_array($name, TranslateIGNORE_FS_NAMES))
			{
				continue;
			}

			if (TranslateIOPath::isPhpFile($fullPath, true))
			{
				$files[$storeFolderRelPath.'/'.$name] = $fullPath;
			}
		}
	}

	// dir only
	$childrenList = TranslateIOFileSystemHelper::getFolderList($langFolderFullPath);
	if (!empty($childrenList))
	{
		$ignoreDev = implode('|', TranslateIGNORE_MODULE_NAMES);
		foreach ($childrenList as $fullPath)
		{
			$name = basename($fullPath);
			if (in_array($name, TranslateIGNORE_FS_NAMES))
			{
				continue;
			}

			$relPath = $langFolderRelPath.'/'.$name;

			if (!is_dir($fullPath))
			{
				continue;
			}

			if (in_array($relPath, TranslateIGNORE_BX_NAMES))
			{
				continue;
			}

			// /bitrix/modules/[smth]/dev/
			if (preg_match("#^bitrix/modules/[^/]+/({$ignoreDev})#", trim($relPath, '/')))
			{
				continue;
			}

			if (in_array($name, TranslateIGNORE_LANG_NAMES))
			{
				continue;
			}

			$folders[$langFolderRelPath.'/'.$name] = $langFolderRelPath.'/'.$name;
		}
	}

	if (count($files) > 0)
	{
		yield $files;
	}

	if (count($folders) > 0)
	{
		foreach ($folders as $subFolderPath)
		{
			foreach ($this->lookThroughLangFolder($subFolderPath) as $subFiles)// go deeper
			{
				yield $subFiles;
			}
		}
	}
}