Project

General

Profile

Actions

Bug #51920

closed

Unable to change language in CLI mode with the current localization utility

Added by Rémy DANIEL over 10 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2013-09-11
Due date:
% Done:

0%

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

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 ?


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #82354: Add possibility to get a label in a specific language in LocalizationUtility::translate()ClosedMarkus Hölzle2017-09-07

Actions
Actions #1

Updated by Rémy DANIEL over 10 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();
        }
    }
Actions #2

Updated by Alexander Opitz over 9 years ago

  • Status changed from New to Needs Feedback

Hi,

was this issue fixed or does it still exists?

Actions #3

Updated by Rémy DANIEL over 9 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

Actions #4

Updated by Rémy DANIEL over 9 years ago

Posted twice the method... Too early in the morning ;)

Actions #5

Updated by Alexander Opitz over 9 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
Actions #6

Updated by Mathias Schreiber over 9 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)
Actions #7

Updated by Benni Mack almost 9 years ago

  • Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
Actions #8

Updated by Susanne Moog over 8 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #9

Updated by Benni Mack over 8 years ago

  • Target version deleted (7.5)
Actions #10

Updated by Gerrit Code Review almost 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

Actions #11

Updated by Gerrit Code Review almost 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

Actions #12

Updated by Gerrit Code Review almost 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

Actions #13

Updated by Gerrit Code Review almost 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

Actions #14

Updated by Gerrit Code Review almost 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

Actions #15

Updated by Gerrit Code Review almost 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

Actions #16

Updated by Gerrit Code Review almost 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

Actions #17

Updated by Gerrit Code Review almost 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

Actions #18

Updated by Gerrit Code Review almost 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

Actions #19

Updated by Gerrit Code Review almost 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

Actions #20

Updated by Gerrit Code Review almost 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

Actions #21

Updated by Gerrit Code Review almost 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

Actions #22

Updated by Riccardo De Contardi over 6 years ago

  • Category changed from Extbase to Extbase + l10n
Actions #23

Updated by Tymoteusz Motylewski over 6 years ago

  • Related to Feature #82354: Add possibility to get a label in a specific language in LocalizationUtility::translate() added
Actions #24

Updated by Rémy DANIEL about 5 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).

Actions #25

Updated by Susanne Moog about 5 years ago

  • Status changed from Under Review to Resolved

See Comment 24.

Actions #26

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF