Commit 91e8eb07 authored by damjan's avatar damjan

[BUGFIX] 'en' => 'default' Index changed back.

parent c6535a96
......@@ -92,7 +92,7 @@ class AddConstantController extends AbstractBackendController {
$langData = $this->configurationService->getFileObj()->getLocalLangData();
$constExists = !empty($langData['en'][$nameOfConstant])
$constExists = !empty($langData['default'][$nameOfConstant])
|| !empty($langData[$extConfig['defaultLanguage']][$nameOfConstant]);
if ($constExists) {
throw new LFException('failure.langfile.constExists');
......
......@@ -140,7 +140,7 @@ class EditFileController extends AbstractBackendController {
$langDefault = is_array($langData[$bottomReferenceLanguageSelection])
? $langData[$bottomReferenceLanguageSelection] : array();
if (empty($langDefault)) {
$langDefault = is_array($langData['en']) ? $langData['en'] : array();
$langDefault = is_array($langData['default']) ? $langData['default'] : array();
}
$langDataSessionContinued = $buttonType != 3;
......
......@@ -186,7 +186,7 @@ class GeneralController extends AbstractBackendController {
$referenceLanguageSelection,
$langArray, $this->configurationService->getFileObj()
);
$description = $infoArray['en']['meta']['description'];
$description = $infoArray['default']['meta']['description'];
$description = preg_replace('/<br.*>/U', "\n", $description);
$langFileExtension = $this->configurationService->getFileObj()->getVar('fileType');
$preselectMerge = $this->isOriginSameForAllLanguages($infoArray);
......@@ -240,7 +240,7 @@ class GeneralController extends AbstractBackendController {
*/
private function isOriginSameForAllLanguages(array $infoArray) {
foreach ($infoArray as $langInfo) {
if ($infoArray['en']['origin'] !== $langInfo['origin']) {
if ($infoArray['default']['origin'] !== $langInfo['origin']) {
return FALSE;
}
}
......
......@@ -104,7 +104,7 @@ class RenameConstantController extends AbstractBackendController {
);
$langData = $this->configurationService->getFileObj()->getLocalLangData();
$constExists = !empty($langData['en'][$newConstantName])
$constExists = !empty($langData['default'][$newConstantName])
|| !empty($langData[$extConfig['defaultLanguage']][$newConstantName]);
if ($constExists) {
throw new LFException('failure.langfile.constExists');
......
......@@ -146,13 +146,13 @@ class ConfigurationService extends AbstractService {
}
if (empty($this->extConfig['defaultLanguage'])) {
$this->extConfig['defaultLanguage'] = 'en';
$this->extConfig['defaultLanguage'] = 'default';
} else {
/** @var Locales $locales */
$locales = GeneralUtility::makeInstance('TYPO3\CMS\Core\Localization\Locales');
$availableLanguageKeys = $locales->getLanguages();
if (!isset($availableLanguageKeys[$this->extConfig['defaultLanguage']])) {
$this->extConfig['defaultLanguage'] = 'en';
$this->extConfig['defaultLanguage'] = 'default';
}
}
return $this->extConfig;
......@@ -473,7 +473,7 @@ class ConfigurationService extends AbstractService {
// rewrite originLang array
$delLangFiles = array();
foreach ($langModes as $langKey => $mode) {
if ($langKey == 'en') {
if ($langKey == 'default') {
continue;
}
......@@ -664,8 +664,8 @@ class ConfigurationService extends AbstractService {
$languages = Functions::buildLangArray($this->extConfig['viewLanguages']);
$languages = $this->narrowToUserLanguages($languages, $backendUser);
if (!in_array('en', $languages)) {
$languages = array_merge(array('en'), $languages);
if (!in_array('default', $languages)) {
$languages = array_merge(array('default'), $languages);
}
if (!in_array($this->extConfig['defaultLanguage'], $languages)) {
$languages = array_merge(array($this->extConfig['defaultLanguage']), $languages);
......@@ -695,7 +695,7 @@ class ConfigurationService extends AbstractService {
$sysLanguageService = $this->objectManager->get('SGalinski\Lfeditor\Service\SysLanguageService');
foreach ($languages as $index => $languageFlag) {
$sysLanguageId = $sysLanguageService->getSysLanguageIdByFlag($languageFlag);
if ($languageFlag === 'en'
if ($languageFlag === 'default'
|| $sysLanguageId !== NULL && $backendUser->checkLanguageAccess($sysLanguageId)
) {
continue;
......
......@@ -392,7 +392,7 @@ class FileBackupService extends FileService {
// convert all values back to their original charsets
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($localLang, FALSE, array('en'));
$this->localLang = Typo3Lib::utf8($localLang, FALSE, array('default'));
} else {
$this->localLang = $localLang;
}
......@@ -409,7 +409,7 @@ class FileBackupService extends FileService {
private function prepareBackupContent() {
// convert all values to utf-8
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$localLang = Typo3Lib::utf8($this->localLang, TRUE, array('en'));
$localLang = Typo3Lib::utf8($this->localLang, TRUE, array('default'));
} else {
$localLang = $this->localLang;
}
......
......@@ -61,7 +61,7 @@ class FileBasePHPService extends FileBaseService {
// convert all language values from the original charset to utf-8
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('default'));
}
}
......@@ -86,7 +86,7 @@ class FileBasePHPService extends FileBaseService {
}
/** @var array $LFMETA */
if ($langKey == 'en') {
if ($langKey == 'default') {
$this->meta = $LFMETA;
}
......@@ -232,7 +232,7 @@ class FileBasePHPService extends FileBaseService {
protected function prepareFileContents() {
// convert all language values from utf-8 to the original charset
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('default'));
}
// prepare Content
......
......@@ -97,14 +97,14 @@ abstract class FileBaseService extends FileService {
*/
public function readFile() {
// read absolute file
$localLang = $this->readLLFile($this->absFile, 'en');
$localLang = $this->readLLFile($this->absFile, 'default');
debug($localLang);
// loop all languages
$languages = SgLib::getSystemLanguages();
$originLang = array();
foreach ($languages as $lang) {
$originLang[$lang] = $this->absFile;
if ((is_array($localLang[$lang]) && count($localLang[$lang])) || $lang === 'en') {
if ((is_array($localLang[$lang]) && count($localLang[$lang])) || $lang === 'default') {
if (is_array($localLang[$lang]) && count($localLang[$lang])) {
ksort($localLang[$lang]);
}
......
......@@ -59,7 +59,7 @@ class FileBaseXLFService extends FileBaseService {
// convert all language values from utf-8 to the original charset
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('default'));
}
}
......@@ -85,7 +85,7 @@ class FileBaseXLFService extends FileBaseService {
throw new LFException('failure.search.noFileContent', 0, '(' . $file . ')');
}
if ($langKey === 'en') {
if ($langKey === 'default') {
$this->meta = $xmlContent['file']['header'];
}
$this->meta['@attributes'] = $xmlContent['file']['@attributes'];
......@@ -127,15 +127,15 @@ class FileBaseXLFService extends FileBaseService {
*/
public function readXlfFile() {
// read absolute file
$localLang['en'] = $this->readLLFile($this->absFile, 'en');
$localLang['en'] = $this->resolveTranslationUnitsArrayIntoFlatArray($localLang['en']);
$localLang['default'] = $this->readLLFile($this->absFile, 'default');
$localLang['default'] = $this->resolveTranslationUnitsArrayIntoFlatArray($localLang['default']);
// loop all languages
$originLang = array();
$languages = SgLib::getSystemLanguages();
foreach ($languages as $lang) {
$originLang[$lang] = $this->absFile;
if ($lang === 'en') {
if ($lang === 'default') {
continue;
}
......@@ -227,7 +227,7 @@ class FileBaseXLFService extends FileBaseService {
*/
private function array2xml($phpArray, $targetLanguage, $enLanguage) {
$targetLanguage = htmlspecialchars($targetLanguage);
$targetLanguageAttribute = ($targetLanguage !== 'en' ? ' target-language="' . $targetLanguage . '"' : '');
$targetLanguageAttribute = ($targetLanguage !== 'default' ? ' target-language="' . $targetLanguage . '"' : '');
$lfeditorExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['lfeditor']);
$date = ($lfeditorExtConf['changeXlfDate'] ? gmdate('Y-m-d\TH:i:s\Z') : $this->meta['@attributes']['date']);
......@@ -254,14 +254,14 @@ class FileBaseXLFService extends FileBaseService {
if (is_array($phpArray['data']) && count($phpArray['data'])) {
$body = '<body>' . "\n";
foreach ($phpArray['data'] as $constant => $value) {
$approved = ($targetLanguage !== 'en' ? ' approved="yes"' : '');
$approved = ($targetLanguage !== 'default' ? ' approved="yes"' : '');
$body .= "\t\t" . '<trans-unit id="' . htmlspecialchars(
$constant
) . '"' . $approved . ' xml:space="preserve">' . "\n";
$enValue = SgLib::htmlSpecialCharsIgnoringCdata($enLanguage[$constant]);
$value = SgLib::htmlSpecialCharsIgnoringCdata($value);
if ($targetLanguage !== 'en') {
if ($targetLanguage !== 'default') {
$body .= "\t\t\t" . '<source>' . $enValue . '</source>' . "\n";
$body .= "\t\t\t" . '<target>' . $value . '</target>' . "\n";
} else {
......@@ -323,16 +323,16 @@ class FileBaseXLFService extends FileBaseService {
protected function prepareFileContents() {
// convert all language values to utf-8
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('default'));
}
// prepare Content
$metaData = $this->prepareMeta();
$languages = SgLib::getSystemLanguages();
$languageFiles = array();
$enLanguage = $this->getLangContent($this->localLang['en']);
$enLanguage = $this->getLangContent($this->localLang['default']);
foreach ($languages as $lang) {
if ($lang === 'en') {
if ($lang === 'default') {
continue;
}
......@@ -356,7 +356,7 @@ class FileBaseXLFService extends FileBaseService {
'header' => $metaData,
'data' => $enLanguage,
);
$languageFiles[$this->absFile] = $this->array2xml($data, 'en', $enLanguage);
$languageFiles[$this->absFile] = $this->array2xml($data, 'default', $enLanguage);
return $languageFiles;
}
......
......@@ -65,7 +65,7 @@ class FileBaseXMLService extends FileBaseService {
// convert all language values from utf-8 to the original charset
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('default'));
}
}
......@@ -91,7 +91,7 @@ class FileBaseXMLService extends FileBaseService {
}
// set header data
if ($langKey == 'en') {
if ($langKey == 'default') {
$this->meta = $xmlContent['meta'];
}
......@@ -282,7 +282,7 @@ class FileBaseXMLService extends FileBaseService {
protected function prepareFileContents() {
// convert all language values to utf-8
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('default'));
}
// prepare Content
......
......@@ -79,12 +79,14 @@ class FileOverrideService extends FileBaseXMLService {
public function readFile() {
if (is_file($this->absFile)) {
parent::readFile();
debug($this->localLang);
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('en'));
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('default'));
}
}
$this->originalFileObject->readFile();
debug($this->originalFileObject->localLang);
$this->mergeOriginalWidthOverrideLangData();
}
......
......@@ -197,7 +197,7 @@ abstract class FileService extends AbstractService {
* @return void
*/
public function setLocalLangData($constant, $value, $langKey, $forceDel = FALSE) {
if (!empty($value) || (($langKey === 'en' && !$forceDel))) {
if (!empty($value) || (($langKey === 'default' && !$forceDel))) {
$this->localLang[$langKey][$constant] = $value;
} elseif (isset($this->localLang[$langKey][$constant])) {
unset($this->localLang[$langKey][$constant]);
......
......@@ -27,7 +27,6 @@ namespace SGalinski\Lfeditor\Utility;
***************************************************************/
use Exception;
use SGalinski\Lfeditor\Exceptions\LFException;
use SGalinski\Lfeditor\Service\FileBasePHPService;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -241,7 +240,7 @@ class Functions {
foreach ($languages as $langKey) {
// get origin data and meta information
$origin = $fileObj->getOriginLangData($langKey);
$infos['en']['meta'] = $fileObj->getMetaData();
$infos['default']['meta'] = $fileObj->getMetaData();
// language data
$localLangData = $fileObj->getLocalLangData($langKey);
......
......@@ -247,7 +247,7 @@ class SgLib {
}
foreach ($availableLanguageKeys as $index => $language) {
if ($language === 'default') {
$availableLanguageKeys[$index] = 'en';
$availableLanguageKeys[$index] = 'default';
break;
}
}
......
......@@ -85,13 +85,13 @@
<label for="name" class="tx-lfeditor-label">
<f:translate key="function.general.metaInfo.author.name" />
</label>
<f:form.textfield id="name" name="authorName" value="{infos.en.meta.authorName}" class="tx-lfeditor-input" />
<f:form.textfield id="name" name="authorName" value="{infos.default.meta.authorName}" class="tx-lfeditor-input" />
</div>
<div>
<label for="email" class="tx-lfeditor-label">
<f:translate key="function.general.metaInfo.author.email" />
</label>
<f:form.textfield id="email" name="authorEmail" value="{infos.en.meta.authorEmail}" class="tx-lfeditor-input" />
<f:form.textfield id="email" name="authorEmail" value="{infos.default.meta.authorEmail}" class="tx-lfeditor-input" />
</div>
</fieldset>
<fieldset class="bgColor4">
......
Markdown is supported
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