Project

General

Profile

Actions

Bug #73353

closed

Unable to set backend user language

Added by KJ Kooistra about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-02-12
Due date:
% Done:

0%

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

Description

When I tried to set the backend language for my (admin) backend user I noticed the labels were not translated. After a little debugging I found the following lines in the BackendUserAuthentication::backendSetUC() method:

// Setting default lang from be_user record.
if (!isset($this->uc['lang'])) {
    $this->uc['lang'] = $this->user['lang'];
    $updated = TRUE;
}

Whether the uc['lang'] is set to the default (empty) value or a specific language key, it is always set. Therefore the uc['lang'] will never be updated with the user['lang'] setting.

I also tested this on a 7.6.2 environment which seems to have the same piece of code, but it asks to relog the backend user after you change the language. So I figured I may need to relog on 6.2, but that didn't work either. Does 7.6 initialize the language somewhere else?

The solution to me seems to be to add an additional condition to the if statement. But I'll leave this to someone who may have some more insight in the language logic.

if (!isset($this->uc['lang']) || $this->uc['lang'] !== $this->user['lang']) {

Tested on TYPO3_6-2 branch with the latest changes.

Actions #1

Updated by Gianluigi Martino about 8 years ago

  • Status changed from New to In Progress
  • Assignee set to Gianluigi Martino
Actions #2

Updated by Gerrit Code Review about 8 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46617

Actions #3

Updated by Gerrit Code Review about 8 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46617

Actions #4

Updated by Markus Klein about 8 years ago

  • Status changed from Under Review to Needs Feedback

I'm failing to reproduce this issue on 6.2 and also 7.

On either version, switching the language immediately updates also the labels of the module menu.

The code you are referring to, is not related to the language switching functionality, but only for setting initial values in case the whole uc has been reset.
The update of the language happens in typo3/sysext/setup/Classes/Controller/SetupModuleController.php:188 on 6.2.

Actions #5

Updated by Gianluigi Martino about 8 years ago

@ KJ Kooistra have you updated from a older TYPO3 version? i had the same issue with a update from 6.1 to 6.2.17

Actions #6

Updated by KJ Kooistra about 8 years ago

@Markus
I reproduced it on 3 different 6.2 installations. When I check the database be_users record I see the lang column was updated to the correct value (nl in my case), but the uc value remains empty (s:4:"lang";s:0:"";). I may have been a little unclear about the 7.6 version, but I was unable to reproduce it there. Which was why I figured there had to be some other place the language is updated.

I checked the SetupModuleController::storeIncomingData() method but it does not seem to be called at all when saving the backend user or logging in again, let alone the specific line you mention.

@Gianluigi
No, the project was developed with 6.2 from the start, although it was still in beta back then.

Actions #7

Updated by Gianluigi Martino about 8 years ago

@ KJ Kooistra can you test my patch?!

Actions #8

Updated by KJ Kooistra about 8 years ago

@Gianluigi
Your patch won't work. It doesn't get past the condition. Note the possible condition change I mentioned in the issue description.

Actions #9

Updated by Markus Klein about 8 years ago

@KJ: I'm really confused now, since the new language should NOT be stored in the "lang" column at all. This is just the default preset assigned by the admin. The actual language is always loaded from uc.

If uc[lang] is not set at all => load default from "lang" column.
An empty string in uc[lang] means "English".

Which extensions are you using? Maybe one of these is causing the issue?

Actions #10

Updated by KJ Kooistra about 8 years ago

@Markus

I just set up a fresh 6.2.18 installation without any additional extensions and I still have the same problem. Additionally I tried creating a new non-admin user:

- Created new user with Dutch language. Lang column is set to nl, uc column is empty.
- Switched to the new user. The uc column is set, lang value is set to nl.
- Switched back to admin user and changed new user language to English. The lang column is empty, but the uc value is still nl.
- Switching to the user again shows the language is still Dutch.

I also reverted the TYPO3 version back to 6.2.0 and it has the same problem. It seems like the behaviour your describe is reversed so the uc lang value stores the initial value and the lang column stores the updated value.

Actions #11

Updated by KJ Kooistra about 8 years ago

Hold on a minute. I see the confusion now. I'm talking about the Backend users module, while the functionality you mentioned is part of the User settings module.

Actions #12

Updated by Markus Klein about 8 years ago

Well, then we have an entirely different story!

The BE Users module is just a nicer UI for editing BE users. As I wrote above, the language you set for a BE user in the database record is just the default value.
The actual language is stored in the uc.

In order to change the language for a user, you either:
  • have to set its new language in the record and clear the uc, or
  • use the switch-to functionality to change to the user in question and use the User Settings to set the preferred language

Generally users should be able to select their language and they (non-admins) can only do it via the user settings.

I see no bug.

Actions #13

Updated by KJ Kooistra about 8 years ago

Right, that explains a lot. I was initially trying to set the language for another user, which I figured could be done with this setting. I guess the label "Default language" didn't ring a bell. Thanks for clearing that up.

Actions #14

Updated by Markus Klein about 8 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Gianluigi Martino)

Alright, closing this issue then.

Actions

Also available in: Atom PDF