[vlma-devel] commit: Enable locale switching. (Adrien Grand )

git version control git at videolan.org
Wed Aug 6 23:05:12 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Wed Aug  6 23:06:45 2008 +0200| [d3f8aabf43ec78ab584c288cadd746021e7c3c86] | committer: Adrien Grand 

Enable locale switching.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=d3f8aabf43ec78ab584c288cadd746021e7c3c86
---

 .../src/main/webapp/WEB-INF/VLMa-servlet.xml       |   16 ++++++++++++++--
 .../src/main/webapp/WEB-INF/jsp/template.jsp       |    4 ++++
 vlma-webapp/src/main/webapp/css/style.css          |    9 +++++++--
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/vlma-webapp/src/main/resources/messages_en.properties b/vlma-webapp/src/main/resources/messages_en.properties
new file mode 100644
index 0000000..e69de29
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml b/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
index c31292a..8ed7505 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
+++ b/vlma-webapp/src/main/webapp/WEB-INF/VLMa-servlet.xml
@@ -335,12 +335,24 @@
     <!-- Others beans -->
 
     <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
-        <property name="basename" value="/messages" />
+        <property name="basename" value="messages" />
+    </bean>
+
+    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>
+
+    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
+        <property name="paramName" value="lang"/>
     </bean>
 
     <bean id="viewNameTranslator" class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator" />
 
-    <bean id="urlMapping" class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
+    <bean id="urlMapping" class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
+        <property name="interceptors">
+            <list>
+                <ref bean="localeChangeInterceptor"/>
+            </list>
+        </property>
+    </bean>
 
     <bean id="dwrUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
         <property name="mappings">
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/template.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/template.jsp
index fbed9fb..6409ece 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/template.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/template.jsp
@@ -23,6 +23,10 @@
 
 <div id="content">
 <div class="header">
+    <div class="lang">
+        <a href="?lang=en">English</a> -
+        <a href="?lang=fr">Français</a>
+    </div>
     <a href="index.jsp">
         <img src="<c:url value="/img/VLMa.png" />" alt="VLMa" />
     </a>
diff --git a/vlma-webapp/src/main/webapp/css/style.css b/vlma-webapp/src/main/webapp/css/style.css
index 27c2a8f..8fdd7b1 100644
--- a/vlma-webapp/src/main/webapp/css/style.css
+++ b/vlma-webapp/src/main/webapp/css/style.css
@@ -75,12 +75,17 @@ p.lien {
 
 .header {
     height: 80px;
-    margin: 0px 0 2px 0;
-    padding: 20px 0 0 5px;
+    margin: 5px;
+    padding: 0;
     border-top: 4px;
     color: #808080;
 }
 
+.lang {
+    float: right;
+    width: 150px;
+}
+
 .searchform {
     float: right;
     padding: 2px 5px 0 0;



More information about the vlma-devel mailing list