You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christoph Nenning <Ch...@lex-com.net> on 2013/09/09 17:04:10 UTC
Framework provided text key resolving issue
Dear List,
We (that means my company) have an application with a file upload form. We
have set struts.multipart.maxSize to 5 MB. When a user tries to upload a
bigger file we rely on struts2 to generate an ActionError. Therefore the
framework uses the msg key
struts.messages.upload.error.SizeLimitExceededException from resource
bundle struts-messages. That bundle is available in several languages.
When I test that application code on my local dev box and request the msg
explicitly with Locale("en"), I get the text in german.
At first sight that seems like a framework bug.
But after some investigation I discovered that the JVM's resource bundle
resolving works not as I would expect.
In this case the following happens:
- struts2's algorithm is performed (search packages hierarchically)
- for global resources the JVM tries the file
"struts-messages_en.properties" which is not present
- then the JVM tries the language from system property "user.language"
which is "de" in my case
- a file for that locale is present and hence I get the german text
instead of the requested english one
We provide our application texts for english in 2 files (of course
scripted):
- bundle.properties
- bundle_en.properties
I propose as workaround that english framework texts are provided the same
way in 2 files.
At least I suggest to put a warning note on i18n wiki pages that
application developers should make sure to have "user.language" set to
"en".
Regards,
Christoph
This Email was scanned by Sophos Anti Virus
Antwort: Re: Re: Framework provided text key resolving issue
Posted by Christoph Nenning <Ch...@lex-com.net>.
>
> Done, resolved!
>
Awesome, thanks :)
> 2013/9/10 Christoph Nenning <Ch...@lex-com.net>:
> >> 2013/9/9 Christoph Nenning <Ch...@lex-com.net>:
> >> > In this case the following happens:
> >> > - struts2's algorithm is performed (search packages hierarchically)
> >> > - for global resources the JVM tries the file
> >> > "struts-messages_en.properties" which is not present
> >> > - then the JVM tries the language from system property
"user.language"
> >> > which is "de" in my case
> >> > - a file for that locale is present and hence I get the german text
> >> > instead of the requested english one
> >>
> >> This is strange, struts-messages bundle should be investigate fully -
> >> first _en then default one. Which JVM version do you use?
> >>
> >
> > Oh, yes that is surely the problem.
> > We use IBM WebSphere with an IBM JVM.
> >
> > Sorry, didn't think about that.
> >
> >
> >
> >> > We provide our application texts for english in 2 files (of course
> >> > scripted):
> >> > - bundle.properties
> >> > - bundle_en.properties
> >> >
> >> > I propose as workaround that english framework texts are provided
the
> > same
> >> > way in 2 files.
> >>
> >> Can you register issue for that?
> >>
> >>
> >
> > Done:
> >
> > https://issues.apache.org/jira/browse/WW-4195
> >
> > This Email was scanned by Sophos Anti Virus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
This Email was scanned by Sophos Anti Virus
Re: Re: Framework provided text key resolving issue
Posted by Lukasz Lenart <lu...@apache.org>.
Done, resolved!
2013/9/10 Christoph Nenning <Ch...@lex-com.net>:
>> 2013/9/9 Christoph Nenning <Ch...@lex-com.net>:
>> > In this case the following happens:
>> > - struts2's algorithm is performed (search packages hierarchically)
>> > - for global resources the JVM tries the file
>> > "struts-messages_en.properties" which is not present
>> > - then the JVM tries the language from system property "user.language"
>> > which is "de" in my case
>> > - a file for that locale is present and hence I get the german text
>> > instead of the requested english one
>>
>> This is strange, struts-messages bundle should be investigate fully -
>> first _en then default one. Which JVM version do you use?
>>
>
> Oh, yes that is surely the problem.
> We use IBM WebSphere with an IBM JVM.
>
> Sorry, didn't think about that.
>
>
>
>> > We provide our application texts for english in 2 files (of course
>> > scripted):
>> > - bundle.properties
>> > - bundle_en.properties
>> >
>> > I propose as workaround that english framework texts are provided the
> same
>> > way in 2 files.
>>
>> Can you register issue for that?
>>
>>
>
> Done:
>
> https://issues.apache.org/jira/browse/WW-4195
>
> This Email was scanned by Sophos Anti Virus
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Antwort: Re: Framework provided text key resolving issue
Posted by Christoph Nenning <Ch...@lex-com.net>.
> 2013/9/9 Christoph Nenning <Ch...@lex-com.net>:
> > In this case the following happens:
> > - struts2's algorithm is performed (search packages hierarchically)
> > - for global resources the JVM tries the file
> > "struts-messages_en.properties" which is not present
> > - then the JVM tries the language from system property "user.language"
> > which is "de" in my case
> > - a file for that locale is present and hence I get the german text
> > instead of the requested english one
>
> This is strange, struts-messages bundle should be investigate fully -
> first _en then default one. Which JVM version do you use?
>
Oh, yes that is surely the problem.
We use IBM WebSphere with an IBM JVM.
Sorry, didn't think about that.
> > We provide our application texts for english in 2 files (of course
> > scripted):
> > - bundle.properties
> > - bundle_en.properties
> >
> > I propose as workaround that english framework texts are provided the
same
> > way in 2 files.
>
> Can you register issue for that?
>
>
Done:
https://issues.apache.org/jira/browse/WW-4195
This Email was scanned by Sophos Anti Virus
Re: Framework provided text key resolving issue
Posted by Łukasz Lenart <lu...@gmail.com>.
2013/9/9 Christoph Nenning <Ch...@lex-com.net>:
> In this case the following happens:
> - struts2's algorithm is performed (search packages hierarchically)
> - for global resources the JVM tries the file
> "struts-messages_en.properties" which is not present
> - then the JVM tries the language from system property "user.language"
> which is "de" in my case
> - a file for that locale is present and hence I get the german text
> instead of the requested english one
This is strange, struts-messages bundle should be investigate fully -
first _en then default one. Which JVM version do you use?
> We provide our application texts for english in 2 files (of course
> scripted):
> - bundle.properties
> - bundle_en.properties
>
> I propose as workaround that english framework texts are provided the same
> way in 2 files.
Can you register issue for that?
Regards
--
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org