- Модуль: translate
- Путь к файлу: ~/bitrix/modules/translate/lib/io/path.php
- Класс: BitrixTranslateIOPath
- Вызов: Path::isLangDir
static function isLangDir(string $path, bool $additionalCheck = false): bool
{
$modifier = TranslateConfig::isUtfMode() ? 'u' : '';
if (preg_match("#/lang/([^/]*?)(/|$)#".$modifier, $path, $match))
{
foreach (TranslateIGNORE_LANG_NAMES as $check)
{
if (mb_strpos($path, '/lang/'.$match[1].'/'.$check.'/') !== false)
{
return false;
}
}
if ($additionalCheck)
{
$arr = explode(self::DIRECTORY_SEPARATOR, $path);
$langKey = array_search('lang', $arr) + 1;
return array_key_exists($langKey, $arr) && $arr[$langKey] <> '';
}
return true;
}
return false;
}