Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Oliver Eglseder
lfeditor
Commits
91e8eb07
Commit
91e8eb07
authored
Mar 20, 2015
by
damjan
Browse files
[BUGFIX] 'en' => 'default' Index changed back.
parent
c6535a96
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
42 additions
and
41 deletions
+42
-41
Classes/Controller/AddConstantController.php
Classes/Controller/AddConstantController.php
+1
-1
Classes/Controller/EditFileController.php
Classes/Controller/EditFileController.php
+1
-1
Classes/Controller/GeneralController.php
Classes/Controller/GeneralController.php
+2
-2
Classes/Controller/RenameConstantController.php
Classes/Controller/RenameConstantController.php
+1
-1
Classes/Service/ConfigurationService.php
Classes/Service/ConfigurationService.php
+6
-6
Classes/Service/FileBackupService.php
Classes/Service/FileBackupService.php
+2
-2
Classes/Service/FileBasePHPService.php
Classes/Service/FileBasePHPService.php
+3
-3
Classes/Service/FileBaseService.php
Classes/Service/FileBaseService.php
+3
-3
Classes/Service/FileBaseXLFService.php
Classes/Service/FileBaseXLFService.php
+12
-12
Classes/Service/FileBaseXMLService.php
Classes/Service/FileBaseXMLService.php
+3
-3
Classes/Service/FileOverrideService.php
Classes/Service/FileOverrideService.php
+3
-1
Classes/Service/FileService.php
Classes/Service/FileService.php
+1
-1
Classes/Utility/Functions.php
Classes/Utility/Functions.php
+1
-2
Classes/Utility/SgLib.php
Classes/Utility/SgLib.php
+1
-1
Resources/Private/Templates/General/General.html
Resources/Private/Templates/General/General.html
+2
-2
No files found.
Classes/Controller/AddConstantController.php
View file @
91e8eb07
...
...
@@ -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'
);
...
...
Classes/Controller/EditFileController.php
View file @
91e8eb07
...
...
@@ -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
;
...
...
Classes/Controller/GeneralController.php
View file @
91e8eb07
...
...
@@ -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
;
}
}
...
...
Classes/Controller/RenameConstantController.php
View file @
91e8eb07
...
...
@@ -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'
);
...
...
Classes/Service/ConfigurationService.php
View file @
91e8eb07
...
...
@@ -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
;
...
...
Classes/Service/FileBackupService.php
View file @
91e8eb07
...
...
@@ -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
;
}
...
...
Classes/Service/FileBasePHPService.php
View file @
91e8eb07
...
...
@@ -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
...
...
Classes/Service/FileBaseService.php
View file @
91e8eb07
...
...
@@ -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
]);
}
...
...
Classes/Service/FileBaseXLFService.php
View file @
91e8eb07
...
...
@@ -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
;
}
...
...
Classes/Service/FileBaseXMLService.php
View file @
91e8eb07
...
...
@@ -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
...
...
Classes/Service/FileOverrideService.php
View file @
91e8eb07
...
...
@@ -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
();
}
...
...
Classes/Service/FileService.php
View file @
91e8eb07
...
...
@@ -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
]);
...
...
Classes/Utility/Functions.php
View file @
91e8eb07
...
...
@@ -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
);
...
...
Classes/Utility/SgLib.php
View file @
91e8eb07
...
...
@@ -247,7 +247,7 @@ class SgLib {
}
foreach
(
$availableLanguageKeys
as
$index
=>
$language
)
{
if
(
$language
===
'default'
)
{
$availableLanguageKeys
[
$index
]
=
'
en
'
;
$availableLanguageKeys
[
$index
]
=
'
default
'
;
break
;
}
}
...
...
Resources/Private/Templates/General/General.html
View file @
91e8eb07
...
...
@@ -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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment