Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #23035 > unrolled thread

Struts I18N

Started byTim Slattery <Slattery_T@bls.gov>
First post2013-03-21 13:01 -0400
Last post2013-03-21 16:11 -0400
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Struts I18N Tim Slattery <Slattery_T@bls.gov> - 2013-03-21 13:01 -0400
    Re: Struts I18N Arne Vajhøj <arne@vajhoej.dk> - 2013-03-21 15:47 -0400
      Re: Struts I18N Tim Slattery <Slattery_T@bls.gov> - 2013-03-21 16:11 -0400

#23035 — Struts I18N

FromTim Slattery <Slattery_T@bls.gov>
Date2013-03-21 13:01 -0400
SubjectStruts I18N
Message-ID<6pemk817nguv4g01eghg78f2vgfusfb2ko@4ax.com>
Does anybody know just when and how often Struts 1.3 sets the "Default
locale"?

We have a web system that kinda-sorta uses Struts
internationalization. The user chooses a language at the beginning
(English or  Spanish). A Locale object is created using that choice,
and saved using the setLocale method of the Action object.

Later Actions will retrieve that Locale object and use the language
designation to find the right things. Among those things are rows in
the database. In the table that's showing the problem, there are rows
identified with "es" or "en", the languages that we support. But we
have a report that one user is getting an error message because the
program is looking for a "zh" (Chinese) row.

My theory is that although either "en" or "es" is set at the beginning
of the app, each request can reset that according to the user's
language preference, though I'm not sure how that's set. If that's
right, then the user with the problem has his browser set for Chinese,
and our setting disappears with his second request. Is this right?

-- 
Tim Slattery
Slattery_T@bls.gov

[toc] | [next] | [standalone]


#23039

FromArne Vajhøj <arne@vajhoej.dk>
Date2013-03-21 15:47 -0400
Message-ID<514b63d0$0$32112$14726298@news.sunsite.dk>
In reply to#23035
On 3/21/2013 1:01 PM, Tim Slattery wrote:
> Does anybody know just when and how often Struts 1.3 sets the "Default
> locale"?
>
> We have a web system that kinda-sorta uses Struts
> internationalization. The user chooses a language at the beginning
> (English or  Spanish). A Locale object is created using that choice,
> and saved using the setLocale method of the Action object.
>
> Later Actions will retrieve that Locale object and use the language
> designation to find the right things. Among those things are rows in
> the database. In the table that's showing the problem, there are rows
> identified with "es" or "en", the languages that we support. But we
> have a report that one user is getting an error message because the
> program is looking for a "zh" (Chinese) row.
>
> My theory is that although either "en" or "es" is set at the beginning
> of the app, each request can reset that according to the user's
> language preference, though I'm not sure how that's set. If that's
> right, then the user with the problem has his browser set for Chinese,
> and our setting disappears with his second request. Is this right?

setLocale saves in session so it should not be changed between
reqeusts.

Can you recreate in test env?

My best guess based on the limited info available is that
your language chooser is not quite safe - you display
a combo box with valid values but process any values - and
that one user found out and made a call with Chinese.

Arne

[toc] | [prev] | [next] | [standalone]


#23040

FromTim Slattery <Slattery_T@bls.gov>
Date2013-03-21 16:11 -0400
Message-ID<d7qmk8d4lsngn6q4r91l5pqdia2sgskefp@4ax.com>
In reply to#23039
Arne Vajhøj <arne@vajhoej.dk> wrote:

>On 3/21/2013 1:01 PM, Tim Slattery wrote:
>> Does anybody know just when and how often Struts 1.3 sets the "Default
>> locale"?
>>
>> We have a web system that kinda-sorta uses Struts
>> internationalization. The user chooses a language at the beginning
>> (English or  Spanish). A Locale object is created using that choice,
>> and saved using the setLocale method of the Action object.
>>
>> Later Actions will retrieve that Locale object and use the language
>> designation to find the right things. Among those things are rows in
>> the database. In the table that's showing the problem, there are rows
>> identified with "es" or "en", the languages that we support. But we
>> have a report that one user is getting an error message because the
>> program is looking for a "zh" (Chinese) row.
>>
>> My theory is that although either "en" or "es" is set at the beginning
>> of the app, each request can reset that according to the user's
>> language preference, though I'm not sure how that's set. If that's
>> right, then the user with the problem has his browser set for Chinese,
>> and our setting disappears with his second request. Is this right?
>
>setLocale saves in session so it should not be changed between
>reqeusts.
>
>Can you recreate in test env?
>
>My best guess based on the limited info available is that
>your language chooser is not quite safe - you display
>a combo box with valid values but process any values - and
>that one user found out and made a call with Chinese.

That was my thought also, but it ain't so. If "es" is passed into the
app, then it creates a locale using "es". If anything else is passed
in, it creates a locale using "en". Never anything else.

-- 
Tim Slattery
Slattery_T@bls.gov

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web