/** * Get a messages context appropriate for the given candidates. * * Will select a language from the candidates, based on the languages available, and fallback to the default language * if none of the candidates are available. */ public Messages preferred(Http.RequestHeader request) { play.api.i18n.Messages msgs = messages.preferred(request); return new Messages(new Lang(msgs.lang()), this); }
/** * Get a messages context appropriate for the given candidates. * * Will select a language from the candidates, based on the languages available, and fallback to the default language * if none of the candidates are available. */ public Messages preferred(Collection<Lang> candidates) { Seq<Lang> cs = JavaConversions.collectionAsScalaIterable(candidates).toSeq(); play.api.i18n.Messages msgs = messages.preferred((Seq) cs); return new Messages(new Lang(msgs.lang()), this); }
protected Binding setUpBindingVariables(Map<String, Object> args) { Binding binding = new Binding(args); binding.setVariable("play", new Play()); binding.setVariable("messages", new Messages()); binding.setVariable("lang", Lang.get()); return binding; }