01/02: Get the best user locale
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See http://git.chorem.org/pollen.git commit e9c18aadbc3e3df0aede745fe41ff002f04fd42b Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Tue Jun 3 15:23:27 2014 +0200 Get the best user locale --- .../chorem/pollen/rest/api/PollenRestApiRequestFilter.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java index c96137d..2ff0e34 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java @@ -137,6 +137,17 @@ public class PollenRestApiRequestFilter extends WebMotionFilter { log.info("Found Accept-Language: " + language); } + String[] allLanguage = language.split(","); + int i = 0; + do { + language = allLanguage[i].substring(0, 2); + if ( !language.equals("fr") && !language.equals("en") ) { + // language not accepted + language = null; + } + i++; + } while (language == null && i < allLanguage.length); + if (language == null) { language = Locale.FRENCH.getLanguage(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm