plainblack.com
Username Password
search
Bookmark and Share

ContentHandler SetLanguage

This contentHandler sets a scratch variable that changes the WebGUI language of the session. It checks whether a Language given as an option and whether it is installed, in both cases it will return undef if the check is negative.

It is just a loose contentHandler, so it is usable in self-set url's by putting:

?op=setLanguage;language=mylanguage;

where mylanguage can be every installed language and delete to remove the scratch variable from the session

Install guide:

Add it to a lib/WebGUI/Content dir (when custom, put it in preload.custom)

The handler has to be added to the config file ( I did it before the AjaxI18N entry, which works for me)

and the less glorious bit:

change line 95 in lib/WebGUI/International.pm from:

    $language =  $language || $self->{_language};

to

    $language = $self->session->scratch->get('language') || $language || $self->{_language};

This last piece will break during upgrade while International.pm is replaced, but is easy to fix.

No test have been made (yet) and the use is at your own risk :)

Author BartJol

Release Notes for Version 2 (8/21/2009)

added comments in the code

Comments
0bartjol: "This feature will be included in WebGUI 7.8, with documentation. Users of older versions can ofcourse still use this. For the implemented (and altered version) tests have been made."
DownloadSetLanguage.pm SetLanguage.pm
LinksNo Support Offered
Statistics Downloads: 480
Views: 1935
Rating: 0
Updated: 8/21/2009
Keywords contenthandler handler language
NavigationMore from BartJol
Back to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved