• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/controller/export/exportaction.php
  • Класс: BitrixTranslateControllerExportExportAction
  • Вызов: ExportAction::lookThroughLangFolder
public function lookThroughLangFolder(string $langPath): iterable
{
	$files = [];
	$folders = [];

	foreach ($this->languages as $langId)
	{
		$langFolderRelPath = TranslateIOPath::replaceLangId($langPath, $langId);
		$langFolderFullPath = TranslateIOPath::tidy(self::$documentRoot.'/'.$langFolderRelPath);

		if (self::$useTranslationRepository && in_array($langId, self::$translationRepositoryLanguages))
		{
			$langFolderFullPath = MainLocalizationTranslation::convertLangPath($langFolderFullPath, $langId);
		}

		$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[$langPath.'/'.$name][$langId] = $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[$langPath.'/'.$name] = $langPath.'/'.$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;
			}
		}
	}
}