Announcement Announcement Module
Collapse
No announcement yet.
DefaultLocale will not activating Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultLocale will not activating

    Hi,

    I'm currently managing localization for my site, with a FixedLocaleResolver bean.
    My site is based on jsp (no controller) and rest service, and I'm using <spring:message> tag to get my locale value.
    Code:
    (ex : <spring:message code="page.title"/> )

    When I know the current user locale (ie a message_<locale>.properties exists), my configuration works fine. But when I try to fallback to a default locale because I'm not supporting the language, it doesn't work.

    My configuration (for internationalization) is the following :

    Code:
    <bean id="messageSource"
    		class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    		<property name="basename" value="file:${jetty.home}/resources/message" />
    		<property name="defaultEncoding" value="UTF-8" />
    	</bean>
    
    	<bean id="localeResolver"
    		class="org.springframework.web.servlet.i18n.FixedLocaleResolver">
    		<property name="defaultLocale" value="en_US" />
    	</bean>

  • #2
    The fixed locale resolver always resolves to the default locale regardless of what the user has set as a locale. So if you see differences between users that is the strange part.

    Also defaultLocale is only used if there is no locale it isn't the one used if you aren't supporting a locale then a properties file without al ocale is used (messages.properties).

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      The fixed locale resolver always resolves to the default locale regardless of what the user has set as a locale. So if you see differences between users that is the strange part.

      Also defaultLocale is only used if there is no locale it isn't the one used if you aren't supporting a locale then a properties file without al ocale is used (messages.properties).
      Thanks for the response. I look again, and it seems that my bean "localeResolver" isn't working (it will not always fallback to my default locale).

      But the second part of your response work for me, so I will do with only ReloadableResourceBundleMessageSource. Thansk a lot.

      Pierrick

      Comment

      Working...
      X