/** * Install translations for all selected languages for an extension * * @param string $extKey The extension key to install the translations for * @param string $lang Language code of translation to fetch * @param string $mirrorURL Mirror URL to fetch data from * @return mixed true on success, error string on fauilure */ function updateTranslation($extKey, $lang, $mirrorURL) { $l10n = $this->fetchTranslation($extKey, $lang, $mirrorURL); if (is_array($l10n)) { $file = PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip'; $path = 'l10n/' . $lang . '/'; if (!is_dir(PATH_typo3conf . $path)) { t3lib_div::mkdir_deep(PATH_typo3conf, $path); } t3lib_div::writeFile($file, $l10n[0]); if (tx_em_Tools::unzip($file, PATH_typo3conf . $path)) { return TRUE; } } return FALSE; }
/** * Install translations for all selected languages for an extension * * @param string $extKey The extension key to install the translations for * @param string $lang Language code of translation to fetch * @param string $mirrorURL Mirror URL to fetch data from * @return mixed true on success, error string on fauilure */ function updateTranslation($extKey, $lang, $mirrorURL) { $l10n = $this->parentObject->terConnection->fetchTranslation($extKey, $lang, $mirrorURL); if (is_array($l10n)) { $file = PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip'; $path = 'l10n/' . $lang . '/'; if (!is_dir(PATH_typo3conf . $path)) { t3lib_div::mkdir_deep(PATH_typo3conf, $path); } t3lib_div::writeFile($file, $l10n[0]); // this prevent first update having errors t3lib_div::rmdir(PATH_typo3conf . $path . $extKey, TRUE); if (tx_em_Tools::unzip($file, PATH_typo3conf . $path)) { return TRUE; } else { return $GLOBALS['LANG']->getLL('translation_unpacking_failed'); } } else { return $l10n; } }