Project

General

Profile

Actions

Bug #60501

closed

Localization in CLI/BE mode

Added by Viktor Livakivskyi over 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-07-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

There is a non-obvious and hacky behaviour, when developer tries to work with Extbase objects in CLI mode (and, probably, BE as well).

The problem is in fact, that using ->setSysLanguageUid($language) on query settings of Repository helps, but only for 1st level object. Child objects are non-localized in CLI mode.

Example:

$languageUid = 7;
// $parents contain correct translations (language=7)
$parents = $parentRepository->findAll($languageUid);
foreach($parents as $parent) {
// $child doesn't contain correct translation (language=0)
$child = $parent->getChild();
}

This can be "solved" in following way.

First you need to call GeneralUtility::_GETset($language, 'L') at the beginning of your action.
Next you need to initialize TypoScriptFrontendController object and set sys_language_mode to 'strict' (if needed), becasue it is used in Typo3DbBackend->doLanguageAndWorkspaceOverlay() method.

This is non-obviuos and hacky workaround.
I'd like Repositiries and PropertyMapper work same regardless from context it is called: FE, BE or CLI; and such settings, which affect the result of Repository and PropertyMapper mthods, as sys_language_mode should be shareable between the context or at least I need to be able to set them without need to initialize TypoScriptFrontendController.

Actions

Also available in: Atom PDF