Commit 83555d53 authored by damjan's avatar damjan

[BUGFIX] Allowing en translation to be empty.

Not throwing exception if main language file has no constants and en is not default language in TYPO3
parent 360cf268
......@@ -75,6 +75,9 @@ class FileBaseXLFService extends FileBaseService {
if (!is_file($file)) {
throw new LFException('failure.select.noLangfile');
}
/** @var ConfigurationService $configurationService */
$configurationService = $this->objectManager->get('SGalinski\Lfeditor\Service\ConfigurationService');
$extConfig = $configurationService->getExtConfig();
// read xml into array
$xmlContent = simplexml_load_file($file);
......@@ -83,7 +86,7 @@ class FileBaseXLFService extends FileBaseService {
// check data
if ((!is_array($xmlContent['file']['body']) || !count($xmlContent['file']['body']))
&& get_class($this) !== 'SGalinski\Lfeditor\Service\FileOverrideService'
// TODO: dont throw exception if main lang file has no constants and en is not default lang (&& 'en' === defaultLang)
&& 'en' === $extConfig['defaultLanguage']
  • Why is this exception thrown at all? When does this makes any sense?

  • It is inherited code. It is thrown if there is no content. And that check is made by checking are there any constants of main language file. Hmmm... So what if there is no content. User can add it. But exception blocks him... Should I remove the check and this exception throwing?

  • If there isn't any case with error potential, then it doesn't makes sense. So drop it...

Please register or sign in to reply
) {
throw new LFException('failure.search.noFileContent', 0, '(' . $file . ')');
}
......
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