1 package org.nextime.ion.frontoffice.servlet; 2 3 import java.util.Iterator ; 4 import java.util.ResourceBundle ; 5 import javax.servlet.http.HttpServletRequest ; 6 import javax.servlet.http.HttpServletResponse ; 7 8 import org.nextime.ion.framework.locale.Locale; 9 import org.nextime.ion.framework.locale.LocaleList; 10 11 14 public class CommonThings { 15 16 public static void common( 17 HttpServletRequest request, 18 HttpServletResponse response) { 19 20 String currentLocale = (String )request.getSession().getAttribute("currentLocale"); 22 if( currentLocale == null ) { 23 currentLocale = ((Locale)LocaleList.getInstance().getLocales().iterator().next()).getLocale(); 24 Iterator it = LocaleList.getInstance().getLocales().iterator(); 26 while (it.hasNext()) { 27 if (((Locale) it.next()).getLocale().equals(request.getLocale().getLanguage())) { 28 currentLocale = request.getLocale().getLanguage(); 29 } 30 } 31 32 request.getSession().setAttribute("currentLocale",currentLocale); 33 } 34 36 request.setAttribute("sectionNameProperty", "name_"+currentLocale); 38 } 39 40 } 41 | Popular Tags |