Bug #51920
closedUnable to change language in CLI mode with the current localization utility
Added by Rémy DANIEL about 11 years ago. Updated over 5 years ago.
0%
Description
I have some batch processing in CLI mode (thus with a BE context).
In a multilingual website, a same batch can process a task for all the defined languages, one after an other.
But the localization utility initialize only once the LOCAL_LANG array, only for the first queried language.
This leads into some translation issues in the frontend when a content processed by a batch process is rendered.
Actually, I have added to the class TYPO3\CMS\Extbase\Utility\LocalizationUtility a method for reseting the LOCAL_LANG array, which I call when I want to change the language.
But maybe there is a proper way, or maybe we should have an api to change the current language ?
Updated by Rémy DANIEL about 11 years ago
This is the method added to \TYPO3\CMS\Extbase\Utility\LocalizationUtility
/** * Reset the loaded translation * If $extensionName is given, the reset apply only for this $extensionName keys. * * @param [type] $extensionName [optional] name of the extension (camelCase) * @return void */ static public function reset($extensionName = NULL) { if (NULL !== $extensionName) { if (isset(self::$LOCAL_LANG[$extensionName])) { unset(self::$LOCAL_LANG[$extensionName]); } } else { self::$LOCAL_LANG = array(); } }
Updated by Alexander Opitz about 10 years ago
- Status changed from New to Needs Feedback
Hi,
was this issue fixed or does it still exists?
Updated by Rémy DANIEL about 10 years ago
Hi
Not fixed, as far as I know.
The project for which I needed this was not updated to the latest version of TYPO3.
Here is the method I added to TYPO3\CMS\Extbase\Utility\LocalizationUtility:
/** * Reset the loaded translation * If $extensionName is given, the reset apply only for this $extensionName keys. * * @param [type] $extensionName [optional] name of the extension (camelCase) * @return void */ static public function reset($extensionName = NULL) { if (NULL !== $extensionName) { if (isset(self::$LOCAL_LANG[$extensionName])) { unset(self::$LOCAL_LANG[$extensionName]); } } else { self::$LOCAL_LANG = array(); } }
I call this method in my batch command when I start to work on a specific language.
Please tell me if you know an other way of doing this, or if you need me that I push something to gerrit.
Cheers
Updated by Rémy DANIEL about 10 years ago
Posted twice the method... Too early in the morning ;)
Updated by Alexander Opitz about 10 years ago
- Project changed from 534 to TYPO3 Core
- Category changed from Extbase: - Language to Extbase
- Status changed from Needs Feedback to New
- Target version set to 7.0
- TYPO3 Version set to 6.2
- Is Regression set to No
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 7.0 to 7.1 (Cleanup)
Updated by Benni Mack over 9 years ago
- Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 8 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 8 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 8 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Gerrit Code Review over 7 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48112
Updated by Riccardo De Contardi about 7 years ago
- Category changed from Extbase to Extbase + l10n
Updated by Tymoteusz Motylewski about 7 years ago
- Related to Feature #82354: Add possibility to get a label in a specific language in LocalizationUtility::translate() added
Updated by Rémy DANIEL almost 6 years ago
The review was marked "abandonned" in profit of #82354 and https://review.typo3.org/#/c/53967/ which was merged on 9.5.
I tested the fix and the initial use case is resolved: I can make translation for multiple languages in the same BE request (like a scheduler task).
Updated by Susanne Moog over 5 years ago
- Status changed from Under Review to Resolved
See Comment 24.