Ubuntu/Spring 3 - Strange issue with locale
I'm experiencing a strange issue with Ubuntu 10.04.1 LTS x86_64 where everything seems to work fine when the system locale is en_US. However, when the system locale is en_GB Spring tries to look for the default resource bundle as en_us rather than en_US.
The exception:
06-Oct-2010 23:35:12 org.springframework.context.support.ResourceBundleMessageSource getResourceBundle
WARNING: ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en_us
System Locale:
taylor@taylor-laptop:~$ locale
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8开发者_运维知识库"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=
taylor@taylor-laptop:~$
The default Spring locale is setup like below:
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="cookieName" value="USER_LOCALE" />
<property name="cookieMaxAge" value="1209600" />
<property name="defaultLocale" value="en_US" />
</bean>
I've checked out the code from your github link above on an Ubuntu VM, and even with my locale changed to match yours:
matt@ubuntu-vm:~/google-app-engine-jappstart$ locale
LANG=en_GB.utf8
LANGUAGE=en_GB:en
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=
when I run mvn gae:run
, I'm able to open up the index page of your webapp fine. I've even verified that if I print out the value of java.util.Locale.getDefault()
from index.jsp, the value is en_GB
.
Are you sure there are no other settings that you have that are causing this issue? Am I attempting to reproduce it incorrectly?
精彩评论