/** * Change durably the lang for the current user. * * @param code New lang code to use (e.g. "fr", "en-US", etc.) * @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(String code) { return changeLang(Lang.forCode(code)); }
/** * Change durably the lang for the current user. * * @param code New lang code to use (e.g. "fr", "en-US", etc.) * @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(String code) { return changeLang(Lang.forCode(code)); }
/** * Create a new version of this object with the given transient language set. * The transient language will be taken into account when using {@link MessagesApi#preferred(RequestHeader)}} (It will take precedence over any other language). * * @param code The language to use. * @return The new version of this object with the given transient language set. */ default RequestHeader withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
/** * Create a new version of this object with the given transient language set. * The transient language will be taken into account when using {@link MessagesApi#preferred(RequestHeader)}} (It will take precedence over any other language). * * @param code The language to use. * @return The new version of this object with the given transient language set. */ default RequestHeader withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
default Request withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
/** * Create a new version of this object with the given transient language set. * The transient language will be taken into account when using {@link MessagesApi#preferred(RequestHeader)}} (It will take precedence over any other language). * * @param code The language to use. * @return The new version of this object with the given transient language set. */ default RequestHeader withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
/** * Change durably the lang for the current user. * @param code New lang code to use (e.g. "fr", "en-US", etc.) * @return true if the requested lang was supported by the application, otherwise false */ public boolean changeLang(String code) { return changeLang(Lang.forCode(code)); }
/** * 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. * * @throws IllegalArgumentException If the given language * is not supported by the application. */ public void setTransientLang(String code) { setTransientLang(Lang.forCode(code)); }
/** * Change durably the lang for the current user. * * @param code New lang code to use (e.g. "fr", "en-US", etc.) * @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(String code) { return changeLang(Lang.forCode(code)); }
default Request withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
/** * 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 code the language code to set (e.g. "en-US") * @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(String code) { setTransientLang(Lang.forCode(code)); }
default Request withTransientLang(String code) { return addAttr(Messages.Attrs.CurrentLang, Lang.forCode(code)); }
/** * 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 code the language code to set (e.g. "en-US") * @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(String code) { setTransientLang(Lang.forCode(code)); }
/** * 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 code the language code to set (e.g. "en-US") * @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(String code) { setTransientLang(Lang.forCode(code)); }