RT 3.0.4: Selection of language in Web-interface

Hi,

we are using RT here for customer support and customer projects, where
the customer can access the web interface.
A question from a Dutch customer was, how to explicitly set the
interface to English. Depending on the client, that is Internet
Explorer, he sometimes get an Englisch or a Dutch interface. Usually
they would want the English localisation, as the tickets are in English.

I would have assumed that you can set this in ‘Preferences’, but I can’t
find it there. But at least I remember Jesse switching to Chinese,
when he gave a talk at the Munich Perl Mongers.

My fallback solution is to set RT to monolingual in RT_SiteConfig.pm.

CU, Bernhard

Bernhard Schmalhofer
Senior Developer

Biomax Informatics AG
Lochhamer Str. 11
82152 Martinsried, Germany

Tel: +49 89 89 55 74 - 839
Fax: +49 89 89 55 74 - 25
PGP: https://ssl.biomax.de/pgp/
Email: mailto:Bernhard.Schmalhofer@biomax.de
Web: http://www.biomax.de

we are using RT here for customer support and customer projects, where
the customer can access the web interface.

I have just done that and sent to rt-devel. Patches pasted below.

/Autrijus/

— //depot/RT/rt/lib/RT/CurrentUser.pm#23
+++ //depot/RT/rt/lib/RT/CurrentUser.pm#24
@@ -329,6 +329,7 @@
if ((!defined $self->{‘LangHandle’}) ||
(!UNIVERSAL::can($self->{‘LangHandle’}, ‘maketext’)) ||
(@_)) {

  • if (my $lang = $self->UserObj->Lang) { unshift @, $lang }
    $self->{‘LangHandle’} = RT::I18N->get_handle(@
    );
    }

    Fall back to english.

— //depot/RT/rt/html/Elements/SelectLang#0
+++ //depot/RT/rt/html/Elements/SelectLang#2
@@ -0,0 +1,55 @@
+%# BEGIN LICENSE BLOCK
+%#+%# Copyright © 1996-2003 Jesse Vincent jesse@bestpractical.com
+%#
+%# (Except where explictly superceded by other copyright notices)
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%#
+%#
+%# END LICENSE BLOCK
+
+% if ($ShowNullOption) {
+-
+% }
+% foreach my $lang (@lang) {
+<OPTION VALUE="<%$lang%>" <%($Default && ($lang eq $Default)) && ‘SELECTED’%>><% $lang_to_desc{$lang} %>
+% if (($Verbose) and (my $description = I18N::LangTags::List::native_name($lang)) ){
+(<%$description%>)
+% }
+
+% }
+
+<%ARGS>
+$ShowNullOption => 1
+$ShowAllQueues => 1
+$Name => undef
+$Verbose => undef
+$Default => 0
+$Lite => 0
+</%ARGS>
+<%ONCE>
+use I18N::LangTags::List;
+my (@lang, %lang_to_desc);
+foreach my $lang (map { s/:://; s//-/g; $ } grep { /^\w+::$/ } keys %RT::I18N::slight_smile: {

  • next if $lang =~ /i-default/;
  • my $desc = I18N::LangTags::List::name($lang);
  • $desc =~ s/(.) (.)/$2 ($1)/;
  • $lang_to_desc{$lang} = $desc;
    +}
    +@lang = sort { $lang_to_desc{$a} cmp $lang_to_desc{$b} } keys %lang_to_desc;
    +</%ONCE>
    — //depot/RT/rt/html/User/Prefs.html#14
    +++ //depot/RT/rt/html/User/Prefs.html#15
    @@ -43,6 +43,8 @@
    <&|/l&>Real Name</&>:


    <&|/l&>Nickname</&>:
    +

    +<&|/l&>Language</&>: <& /Elements/SelectLang, Name => ‘Lang’, Default => $UserObj->Lang &>
    <& /Elements/TitleBoxEnd &>


    <& /Elements/TitleBoxStart, title => loc(‘Phone numbers’) &>
    @@ -147,12 +149,13 @@
    Organization RealName NickName Lang EmailEncoding WebEncoding
    ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
    AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
  •   Address2 City State Zip Country 
    
  •   Address2 City State Zip Country Lang
         );
    

    my @fieldresults = UpdateRecordObject ( AttributesRef => @fields,
    Object => $UserObj,
    ARGSRef => %ARGS );

  • $session{‘CurrentUser’}->LanguageHandle($Lang);
    push (@results,@fieldresults);