localization - Spring Framework - How to change locale in controller -
i new spring, , confusing localization. i'm using following code text messages_jp.properties file.
<bean id="messagesource" class="org.springframework.context.support.resourcebundlemessagesource"> <property name="basename" value="messages" /> </bean>
and want switch text messages_en.properties file, there ways change locale in controller within if...else... block, not using url params "?lang=en", like:
if (user.getlang() == 1) { // set locale en } else { // set locale jp }
thanks in advance!
try one
<util:properties id="yourfilenameid" location="classpath:/yourfilename.properties"/>
in controller
@value("#{yourfilenameid['message_id']?:1}") private int smalltext;
Comments
Post a Comment