private String determineLanguage ( FacesContext fc , DataTable dataTable ) { final List < String > availableLanguages = Arrays . asList ( "de" , "en" , "es" , "fr" , "hu" , "it" , "nl" , "pl" , "pt" , "ru" ) ; if ( BsfUtils . isStringValued ( dataTable . getCustomLangUrl ( ) ) ) { return dataTable . getCustomLangUrl ( ) ; } else if ( BsfUtils . isStringValued ( dataTable . getLang ( ) ) ) { String lang = dataTable . getLang ( ) ; if ( availableLanguages . contains ( lang ) ) { return determineLanguageUrl ( fc , lang ) ; } } else { String lang = fc . getViewRoot ( ) . getLocale ( ) . getLanguage ( ) ; if ( availableLanguages . contains ( lang ) ) { return determineLanguageUrl ( fc , lang ) ; } } return null ; }
Determine if the user specify a lang Otherwise return null to avoid language settings .