[TYPO3-english] Select language at login, based on language preference in fe_users table

bernd wilke x00nsji02 at sneakemail.com
Fri Apr 17 02:05:04 CEST 2009


Am Thu, 16 Apr 2009 19:34:07 +0200 schrieb Loek Hilgersom:

> Hi,
> 
> I'm working on a multi-language site where users have a setting
> 'preferred language' in their user profile, which is stored in the
> fe_users table.
> 
> Is there a way I can automatically select that preferred language at the
> moment the user logs in?
> 
> I was thinking of using a bit of typoscript like this:
> 
> # detect a succesful login
> [globalVar = GP:pass > 0] && [loginUser = *] # get the preferred
> language from fe_users table and set appropriate config
> config.sys_language_uid = ...
> ....
> [global]
> 
> The problem with that is that it won't change the TS conditions based on
> the L-var used elsewhere to change certain parts of the site depending
> on the language chosen, so you'll end up with pages containing a mixture
> of 2 languages.

your languagesettings may depend on fe_user-field AND L:

your conditions should be build to select both values and give precedence 
to one of these.


another solution could be a forwarding after login to include a 
appropiate L-paramter to the actual URL. something like:

if (L not set) and (userlogin) {
	stop render page
	forward to acturl . '&L='.language_of_user
}

your problem may be the default-language, as L=0 equals to no language 
selected. therefore:
if (L not set) and (userlogin) and (language_of_user>0) {
 :
}

bernd
-- 
http://www.pi-phi.de/t3v4/cheatsheet.html


More information about the TYPO3-english mailing list