33 $mirrorUrl .= $extPath[0] .
'/' . $extPath[1] .
'/' . $extPath .
'-l10n/' . $extPath .
'-l10n.xml';
34 $remote = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($mirrorUrl, 0, array(TYPO3_user_agent));
38 $result = $parsed[
'languagePackIndex'];
53 $parser = xml_parser_create();
55 $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
59 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
60 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
63 xml_parse_into_struct($parser, $string, $values, $index);
64 libxml_disable_entity_loader($previousValueOfEntityLoader);
66 if (xml_get_error_code($parser)) {
67 $line = xml_get_current_line_number($parser);
68 $error = xml_error_string(xml_get_error_code($parser));
69 xml_parser_free($parser);
70 throw new \TYPO3\CMS\Lang\Exception\XmlParser(
'Error in XML parser while decoding l10n XML file. Line ' . $line .
': ' . $error, 1345736517);
73 $stack = array(array());
80 foreach ($values as $val) {
82 $tagName = ($val[
'tag'] ==
'languagepack' && $val[
'type'] ==
'open') ? $val[
'attributes'][
'language'] : $val[
'tag'];
84 $documentTag = $tagName;
88 switch ($val[
'type']) {
93 $current[$tagName] = array();
94 $stack[$stacktop++] = $current;
99 $oldCurrent = $current;
100 $current = $stack[--$stacktop];
103 $current[key($current)] = $oldCurrent;
108 $trimmedValue = trim((
string)$val[
'value']);
109 if ($trimmedValue !==
'') {
110 $current[$tagName] = $trimmedValue;
133 if (is_array($l10n)) {
135 $relativeLanguagePath =
'l10n' .
'/' . $language .
'/';
138 if (empty($absolutePathToZipFile) || empty($absoluteLanguagePath) || empty($absoluteExtensionLanguagePath)) {
139 throw new \TYPO3\CMS\Lang\Exception\Lang(
'Given path is invalid.', 1352565336);
141 if (!is_dir($absoluteLanguagePath)) {
145 if (is_dir($absoluteExtensionLanguagePath)) {
153 }
catch (\
TYPO3\CMS\Core\Exception $exception) {
170 $mirrorUrl .= $extensionPath[0] .
'/' . $extensionPath[1] .
'/' . $extensionPath .
171 '-l10n/' . $extensionPath .
'-l10n-' . $language .
'.zip';
172 $l10nResponse = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($mirrorUrl, 0, array(TYPO3_user_agent));
174 if ($l10nResponse === FALSE) {
175 throw new \TYPO3\CMS\Lang\Exception\XmlParser(
'Error: Translation could not be fetched.', 1345736785);
177 return array($l10nResponse);
190 $zip = zip_open($file);
191 if (is_resource($zip)) {
194 if (!is_dir($path)) {
198 while (($zipEntry = zip_read($zip)) !== FALSE) {
199 $zipEntryName = zip_entry_name($zipEntry);
200 if (strpos($zipEntryName,
'/') !== FALSE) {
201 $zipEntryPathSegments = explode(
'/', $zipEntryName);
202 $fileName = array_pop($zipEntryPathSegments);
204 if (empty($fileName)) {
208 if (strlen(trim($absoluteTargetPath)) > 0) {
210 $absoluteTargetPath, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry))
212 if ($return === FALSE) {
213 throw new \TYPO3\CMS\Lang\Exception\Lang(
'Could not write file ' . $zipEntryName, 1345304560);
216 throw new \TYPO3\CMS\Lang\Exception\Lang(
'Could not write file ' . $zipEntryName, 1352566904);
220 throw new \TYPO3\CMS\Lang\Exception\Lang(
'Extension directory missing in zip file!', 1352566905);
224 throw new \TYPO3\CMS\Lang\Exception\Lang(
'Unable to open zip file ' . $file, 1345304561);
static mkdir_deep($directory, $deepDirectory='')
static writeFile($file, $content, $changePermissions=FALSE)
unzipTranslationFile($file, $path)
static rmdir($path, $removeNonEmpty=FALSE)
fetchTranslation($extensionKey, $language, $mirrorUrl)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
updateTranslation($extensionKey, $language, $mirrorUrl)
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)
fetchTranslationStatus($extensionKey, $mirrorUrl)