igriffiths / pwm

Automatically exported from code.google.com/p/pwm
0 stars 0 forks source link

Language switching #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In the current revision there is no way to change the language. The language 
preference is based on the browser preference, which may not always be set 
correctly (because a user is not on his own computer, but in an Internet cafe 
or using a friend's computer). The language is stored in the Java session. A 
mechanism is needed to the change the session locale.

What is the expected output? What do you see instead?
Expected: interface in selected language:
Now: interface only in browser negotiated language

What version of the product are you using? On what operating system?
svn revision 97

Please provide any additional information below.
A patch for header.jsp is attached. This will allow a user to add ?lang=XX to 
the URL and change the display language.

Not included in this patch, but needed for user friendliness is a language 
selector within the interface. For our customer we've solved this in the 
head-body.jsp with links to "?lang=XX", where XX are the selectable languages.

Original issue reported on code.google.com by menno.pi...@gmail.com on 5 Jan 2011 at 2:56

Attachments:

GoogleCodeExporter commented 9 years ago
Actually, pwm already watches a parameter "pwmLocale" to change the locale of 
the session, although it's not documented.  I'll not commit the diff because 
the functionality is there, although I will ammend the admin doc to include the 
pwmLocale parameter info.

If you have achieved a visually attractive and functional locale switcher for 
the header, I'd be interested in reviewing that for inclusion into the 
codebase..

Original comment by jrivard on 5 Jan 2011 at 3:46

GoogleCodeExporter commented 9 years ago
OK, I've updated my code to use pwmLocal=XX instead of lang=XX and that
seems to work, so you can ignore my patch.

The one we're using is very customer specific and only using Dutch and
English with simple HTML links. A more general solution could be a drop
down list based on the array provided by java.util.Locale.getISOLanguages().

Something like:

<form name="langselector" method="GET">
  <select name="pwmLocale"
onChange="document.forms[languageselector].submit">
    <option value="en" selected>en</option>
    <option value="es">es</option>
    <option value="de">de</option>
    <!-- ... -->
  </select>
</form>

(this is just a rough, untested example, but should be generated by JSP
and use some nice CSS to make it fit in the interface).

Original comment by menno.pi...@gmail.com on 5 Jan 2011 at 4:03

GoogleCodeExporter commented 9 years ago
Approach is good, just looking for a good pretty implementation?  Maybe a dojo 
menu popup from the footer?

Original comment by jrivard on 15 Jan 2011 at 1:34

GoogleCodeExporter commented 9 years ago
Implemented as of version 102.

Original comment by jrivard on 16 Jan 2011 at 5:18

GoogleCodeExporter commented 9 years ago

Original comment by jrivard on 16 Jan 2011 at 5:18