37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
--- a/classes/Language.php
|
|
+++ b/classes/Language.php
|
|
@@ -1235,6 +1235,12 @@
|
|
*/
|
|
public static function downloadXLFLanguagePack($locale, &$errors = [], $type = self::PACK_TYPE_SYMFONY)
|
|
{
|
|
+ // EduBox: if the translation pack is already present in the image,
|
|
+ // do not try to download it (agents may be offline).
|
|
+ if (static::translationPackIsInCache($locale, $type)) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
$file = self::getPathToCachedTranslationPack($locale, $type);
|
|
$url = (self::PACK_TYPE_EMAILS === $type) ? self::EMAILS_LANGUAGE_PACK_URL : self::SF_LANGUAGE_PACK_URL;
|
|
$url = str_replace(
|
|
@@ -1697,7 +1703,9 @@
|
|
*/
|
|
public static function translationPackIsInCache(string $locale, string $type = self::PACK_TYPE_SYMFONY): bool
|
|
{
|
|
- return file_exists(self::getPathToCachedTranslationPack($locale, $type));
|
|
+ // EduBox: use runtime constant instead of class constant, because
|
|
+ // _PS_TRANSLATIONS_DIR_ may not be defined when this file is compiled.
|
|
+ return file_exists(_PS_TRANSLATIONS_DIR_ . $type . '-' . $locale . '.zip');
|
|
}
|
|
|
|
/**
|
|
@@ -1710,7 +1718,8 @@
|
|
*/
|
|
private static function getPathToCachedTranslationPack(string $locale, string $type = self::PACK_TYPE_SYMFONY): string
|
|
{
|
|
- return self::TRANSLATION_PACK_CACHE_DIR . $type . '-' . $locale . '.zip';
|
|
+ // EduBox: use runtime constant instead of class constant.
|
|
+ return _PS_TRANSLATIONS_DIR_ . $type . '-' . $locale . '.zip';
|
|
}
|
|
|
|
/**
|