[BUGIFX] Translations action only returning default language

This commit is contained in:
Philipp Dieter 2026-03-12 17:22:28 +01:00
parent b2f9fa6846
commit 0e77b7a75a

View File

@ -46,18 +46,18 @@ class TranslationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionCont
} else { } else {
$language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language'); $language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
} }
$locale = $language->getLocale(); $language = $language->getTypo3language();
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
// $locale, '$locale', 3, true, false
//);
$langfileContent = $languageFactory->getParsedData( $langfileContent = $languageFactory->getParsedData(
$langfilePath, $langfilePath,
$locale $language
); );
$langfileResult = []; $langfileResult = [];
foreach (reset($langfileContent) as $key => $row) { foreach (reset($langfileContent) as $key => $row) {
$langfileResult[$key] = reset($row)['target']; $langfileResult[$key] = reset($row)['target'];
} }
foreach ($langfileContent[$language] as $key => $row) {
$langfileResult[$key] = reset($row)['target'];
}
$result[$extension] = $langfileResult; $result[$extension] = $langfileResult;
} }
$GLOBALS['TSFE']->setContentType('application/json'); $GLOBALS['TSFE']->setContentType('application/json');