Hi!
For many days I've been trying to get my validation messages in English
(from computers (both client and server) with Swedish regional
settings). Today I got a certain success fulfilling my needs, but I need
you guys to shed the light on some details... I believe I read all the
pertinent material regarding the issue both in the Tapestry docs and in
the archives for this mailing-list.
I overrode the setLocale() method in my custom Engine so that it would
be set to "Locale.UK".
This took care of the Engine for the locale UK, and indeed it was the
Engine called for all my requests. A <span jwcid="@Insert"
value="ognl:engine.locale"/> on my page proved to me that the locale for
my page was "en_GB". So I expected to see my validation error messages
in English... but they actually were in Swedish.
I'm guessing since there is no "ValidationStrings_en.properties" in
org/apache/tapestry/valid/ ("ValidationStrings.properties" is present
though, with English messages), it defaulted to Swedish, and therefore
took "ValidationStrings_sv.properties".
I thought that this line in my app.application would make the default
locale to English:
<meta key="org.apache.tapestry.accepted-locales" value="en" />
I also (unsuccessfully) tried to provide my own implementation of
tapestry.request.RequestLocaleManager like this (in hivemodule.xml):
<implementation service-id="tapestry.request.RequestLocaleManager">
<invoke-factory>
<construct class="com.pricerunner.carhire.utils.PRRequestLocaleManager">
<set-service property="threadLocale"
service-id="hivemind.ThreadLocale"/>
</construct>
</invoke-factory>
</implementation>
Here is what my RequestLocaleManager implementation looks like:
public class PRRequestLocaleManager implements RequestLocaleManager {
private ThreadLocale _threadLocale;
public Locale extractLocaleForCurrentRequest() {
_threadLocale.setLocale(Locale.UK);
return Locale.UK;
}
public void setThreadLocale(ThreadLocale threadLocale) {
_threadLocale = threadLocale;
}
}
Although I know my PRRequestLocaleManager was called according to my
logs, it didn't help to set the default locale to English (since my
validation messages were still in Swedish). And there is no trace
whatsoever of a creation of an Engine for the Swedish locale (I was
logging in both getLocale() and setLocale() of my custom Engine).
So after all those unsuccessful experiments, I included a
"ValidationStrings_en.properties" file in org/apache/tapestry/valid and
it worked out.
But my question still holds. How can I force the default locale (to
English in my case)?
/Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]