我只是想找出一些好的方法来检测语言环境。
我遵循的方法是:
1-具有以下代码的一种语言 Bean
<code>
if(!classUtil.isNullObject(FacesContext.getCurrentInstance())){
return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
}
return selectedLanguage;//Return default language in case its not possible to detect the language
</code>
2- 在父流中创建 bean 定义
<code><var name="languageBean" class="com.decitysearch.classified.LanguageBean"/></code>
3-在xhtml中使用相同的
<code>
<f:view locale="#{languageBean.findDefaultLocale}">
<f:loadBundle var="messageResource" basename="MessageResource_en"/>
</code>
我的问题是这样的: 1-我们不能像我尝试使用 spring-context 但得到一些范围异常那样在 spring-context 中而不是 flow bean 中创建 bean 条目。2-是否有任何检测语言环境的好方法
非常感谢您的思考过程。