- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/controller/editor/operation.php
- Класс: BitrixTranslateControllerEditorOperation
- Вызов: Operation::lookThroughLangFolder
protected function lookThroughLangFolder($langPath): iterable
{
$files = [];
$folders = [];
foreach (self::$enabledLanguagesList as $langId)
{
$langFolderRelPath = TranslateIOPath::replaceLangId($langPath, $langId);
$langFolderFullPath = TranslateIOPath::tidy(self::$documentRoot.'/'.$langFolderRelPath);
$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;
}
}
}
}