Commit 5131c838 authored by Xavier Perseguers's avatar Xavier Perseguers Committed by Frank Nägler
Browse files

[TASK] Retrieve v7-compatible localisation packages

Since TYPO3 v7, the translation server is packaging version-dependent localisation
packages containing only XLIFF (and no more ll-XML) and targeted labels without any
obsolete ones anymore.

Change-Id: Idccbe4eb4b1546bc21757361d872c9f1e3a6bf04
Resolves: #68187
Releases: master
Reviewed-on: http://review.typo3.org/41420


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
parent 0e58cbea
......@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Lang\Service;
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
/**
* Extends of extensionmanager ter connection to enrich with translation
......@@ -158,9 +159,26 @@ class TerService extends \TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtili
*/
protected function fetchTranslation($extensionKey, $language, $mirrorUrl) {
$extensionPath = GeneralUtility::strtolower($extensionKey);
$mirrorUrl .= $extensionPath[0] . '/' . $extensionPath[1] . '/' . $extensionPath .
// Typical non sysext path, Hungarian:
// http://my.mirror/ter/a/n/anextension-l10n/anextension-l10n-hu.zip
$packageUrl = $extensionPath[0] . '/' . $extensionPath[1] . '/' . $extensionPath .
'-l10n/' . $extensionPath . '-l10n-' . $language . '.zip';
$l10nResponse = GeneralUtility::getURL($mirrorUrl, 0, array(TYPO3_user_agent));
try {
$path = ExtensionManagementUtility::extPath($extensionPath);
if (strpos($path, DIRECTORY_SEPARATOR . 'sysext' . DIRECTORY_SEPARATOR) !== FALSE) {
// This is a system extension and the package URL should be adapted
list($majorVersion, ) = explode('.', TYPO3_branch);
// Typical non sysext path, mind the additional version part, French
// http://my.mirror/ter/b/a/backend-l10n/backend-l10n-fr.v7.zip
$packageUrl = $extensionPath[0] . '/' . $extensionPath[1] . '/' . $extensionPath .
'-l10n/' . $extensionPath . '-l10n-' . $language . '.v' . $majorVersion . '.zip';
}
} catch (\BadFunctionCallException $e) {
// Nothing to do
}
$l10nResponse = GeneralUtility::getURL($mirrorUrl . $packageUrl, 0, array(TYPO3_user_agent));
if ($l10nResponse === FALSE) {
throw new \TYPO3\CMS\Lang\Exception\XmlParser('Error: Translation could not be fetched.', 1345736785);
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment