/** * Change language for next requests * * @param locale (e.g. "fr", "ja", "it", "en_ca", "fr_be", ...) */ public static void change(String locale) { String closestLocale = findClosestMatch(Collections.singleton(locale)); if (closestLocale == null) { // Give up return; } if (set(closestLocale)) { Response response = Response.current(); if (response != null) { // We have a current response in scope - set the language-cookie to store the selected language for the next requests response.setCookie(Play.configuration.getProperty("application.lang.cookie", "PLAY_LANG"), locale, null, "/", null, Scope.COOKIE_SECURE); } } }