/** * Set the language for the current request, but don't * change the language cookie. This means the language * will be set for this request, but will not change for * future requests. * * @param lang the language to set * @throws IllegalArgumentException If the given language * is not supported by the application. * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public void setTransientLang(Lang lang) { final Langs langs = components.langs(); if (langs.availables().contains(lang)) { this.lang = lang; } else { throw new IllegalArgumentException("Language not supported in this application: " + lang + " not in " + langs.availables()); } }
@Override default JavaContextComponents javaContextComponents() { return JavaHelpers$.MODULE$.createContextComponents( messagesApi().asScala(), langs().asScala(), fileMimeTypes().asScala(), httpConfiguration() ); }
@Override default JavaContextComponents javaContextComponents() { return JavaHelpers$.MODULE$.createContextComponents( messagesApi().asScala(), langs().asScala(), fileMimeTypes().asScala(), httpConfiguration() ); }
@Override default JavaContextComponents javaContextComponents() { return JavaHelpers$.MODULE$.createContextComponents( messagesApi().asScala(), langs().asScala(), fileMimeTypes().asScala(), httpConfiguration() ); }
/** * Set the language for the current request, but don't * change the language cookie. This means the language * will be set for this request, but will not change for * future requests. * * @param lang the language to set * @throws IllegalArgumentException If the given language * is not supported by the application. * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public void setTransientLang(Lang lang) { final Langs langs = components.langs(); if (langs.availables().contains(lang)) { this.lang = lang; } else { throw new IllegalArgumentException("Language not supported in this application: " + lang + " not in " + langs.availables()); } }
@Override default MessagesApi messagesApi() { return new DefaultMessagesApiProvider( environment().asScala(), configuration(), langs().asScala(), httpConfiguration() ).get().asJava(); }
/** * Set the language for the current request, but don't * change the language cookie. This means the language * will be set for this request, but will not change for * future requests. * * @param lang the language to set * @throws IllegalArgumentException If the given language * is not supported by the application. * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public void setTransientLang(Lang lang) { final Langs langs = components.langs(); if (langs.availables().contains(lang)) { this.lang = lang; } else { throw new IllegalArgumentException("Language not supported in this application: " + lang + " not in " + langs.availables()); } }
@Override default MessagesApi messagesApi() { return new DefaultMessagesApiProvider( environment().asScala(), configuration(), langs().asScala(), httpConfiguration() ).get().asJava(); }
/** * Change durably the lang for the current user. * * @param lang New Lang object to use * @return true if the requested lang was supported by the application, otherwise false. * * @deprecated Deprecated as of 2.7.0. Use {@link MessagesApi#setLang(Result, Lang)}. */ @Deprecated public boolean changeLang(Lang lang) { if (langs().availables().contains(lang)) { this.lang = lang; scala.Option<String> domain = sessionDomain(); Cookie langCookie = new Cookie(messagesApi().langCookieName(), lang.code(), null, sessionPath(), domain.isDefined() ? domain.get() : null, messagesApi().langCookieSecure(), messagesApi().langCookieHttpOnly(), messagesApi().langCookieSameSite().orElse(null) ); response.setCookie(langCookie); return true; } else { return false; } }
@Override default MessagesApi messagesApi() { return new DefaultMessagesApiProvider( environment().asScala(), configuration(), langs().asScala(), httpConfiguration() ).get().asJava(); }
/** * Change durably the lang for the current user. * * @param lang New Lang object to use * @return true if the requested lang was supported by the application, otherwise false. * * @deprecated Deprecated as of 2.7.0. Use {@link MessagesApi#setLang(Result, Lang)}. */ @Deprecated public boolean changeLang(Lang lang) { if (langs().availables().contains(lang)) { this.lang = lang; scala.Option<String> domain = sessionDomain(); Cookie langCookie = new Cookie(messagesApi().langCookieName(), lang.code(), null, sessionPath(), domain.isDefined() ? domain.get() : null, messagesApi().langCookieSecure(), messagesApi().langCookieHttpOnly(), messagesApi().langCookieSameSite().orElse(null) ); response.setCookie(langCookie); return true; } else { return false; } }
/** * Change durably the lang for the current user. * * @param lang New Lang object to use * @return true if the requested lang was supported by the application, otherwise false. * * @deprecated Deprecated as of 2.7.0. Use {@link MessagesApi#setLang(Result, Lang)}. */ @Deprecated public boolean changeLang(Lang lang) { if (langs().availables().contains(lang)) { this.lang = lang; scala.Option<String> domain = sessionDomain(); Cookie langCookie = new Cookie(messagesApi().langCookieName(), lang.code(), null, sessionPath(), domain.isDefined() ? domain.get() : null, messagesApi().langCookieSecure(), messagesApi().langCookieHttpOnly(), messagesApi().langCookieSameSite().orElse(null) ); response.setCookie(langCookie); return true; } else { return false; } }