1 24 package org.riotfamily.website.i18n; 25 26 import java.util.Locale ; 27 28 import javax.servlet.http.HttpServletRequest ; 29 30 import org.springframework.util.StringUtils; 31 32 36 public class ParameterLocaleResolver extends ChainedLocaleResolver { 37 38 private String localeParameter = "locale"; 39 40 public void setLocaleParameter(String localeParameter) { 41 this.localeParameter = localeParameter; 42 } 43 44 protected Locale resolveLocaleInternal(HttpServletRequest request) { 45 String localeString = request.getParameter(localeParameter); 46 if (localeString != null) { 47 return StringUtils.parseLocaleString(localeString); 48 } 49 return null; 50 } 51 52 } 53 | Popular Tags |