45 if ($langFile->isExists() && Translate\Config::needToBackUpFiles())
47 if (!$langFile->backup())
50 Loc::getMessage(
'TR_CREATE_BACKUP_ERROR', [
'#FILE#' => $langFile->getPath()])
56 if (Translate\Config::needToSortPhrases())
58 if (\in_array($langFile->getLangId(), Translate\Config::getNonSortPhraseLanguages()) ===
false)
60 $langFile->sortPhrases();
66 if (!$langFile->save())
68 if ($langFile->hasErrors())
78 if (!$langFile->isExists())
81 Loc::getMessage(
'TR_ERROR_WRITE_CREATE', [
'#FILE#' => $langFile->getPath()])
87 Loc::getMessage(
'TR_ERROR_WRITE_UPDATE', [
'#FILE#' => $langFile->getPath()])
188 foreach (self::$enabledLanguagesList as $langId)
190 $langFolderRelPath = Translate\IO\Path::replaceLangId($langPath, $langId);
191 $langFolderFullPath = Translate\IO\Path::tidy(self::$documentRoot.
'/'.$langFolderRelPath);
192 $langFolderFullPath = Main\Localization\Translation::convertLangPath($langFolderFullPath, $langId);
194 $childrenList = Translate\IO\FileSystemHelper::getFileList($langFolderFullPath);
195 if (!empty($childrenList))
197 foreach ($childrenList as $fullPath)
199 $name = \basename($fullPath);
200 if (\in_array(
$name, Translate\IGNORE_FS_NAMES))
205 if (Translate\
IO\Path::isPhpFile($fullPath,
true))
207 $files[$langPath.
'/'.
$name][$langId] = $fullPath;
213 $childrenList = Translate\IO\FileSystemHelper::getFolderList($langFolderFullPath);
214 if (!empty($childrenList))
216 $ignoreDev = \implode(
'|', Translate\IGNORE_MODULE_NAMES);
217 foreach ($childrenList as $fullPath)
219 $name = \basename($fullPath);
220 if (\in_array(
$name, Translate\IGNORE_FS_NAMES))
225 $relPath = $langFolderRelPath.
'/'.
$name;
227 if (!\is_dir($fullPath))
232 if (\in_array($relPath, Translate\IGNORE_BX_NAMES))
238 if (\preg_match(
"#^bitrix/modules/[^/]+/({$ignoreDev})$#", \trim($relPath,
'/')))
243 if (\in_array(
$name, Translate\IGNORE_LANG_NAMES))
248 $folders[$langPath.
'/'.
$name] = $langPath.
'/'.
$name;
253 if (\count($files) > 0)
258 if (\count($folders) > 0)
260 foreach ($folders as $subFolderPath)