@Override @Deprecated public Lang lang() { return wrapped.lang(); }
@Override @Deprecated public Lang lang() { return wrapped.lang(); }
@Override @Deprecated public Lang lang() { return wrapped.lang(); }
private Http.Context getMockContext() { Http.Request mockRequest = mock(Http.Request.class); when(mockRequest.remoteAddress()).thenReturn("127.0.0.1"); when(mockRequest.getHeader("User-Agent")).thenReturn("mocked user-agent"); // ... and so on. Mock precisely what you need, then add it to your mocked Context Http.Context mockContext = mock(Http.Context.class); when(mockContext.request()).thenReturn(mockRequest); when(mockContext.lang()).thenReturn(Lang.forCode("en")); return mockContext; }
@Override public Lang lang() { return wrapped.lang(); }
/** * Returns the current lang. * * @return the language * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public static Lang lang() { return Http.Context.current().lang(); }
private static Lang getLang(){ Lang lang = null; if(play.mvc.Http.Context.current.get() != null) { lang = play.mvc.Http.Context.current().lang(); } else { Locale defaultLocale = Locale.getDefault(); lang = new Lang(new play.api.i18n.Lang(defaultLocale.getLanguage(), defaultLocale.getCountry())); } return lang; }
/** * Returns the current lang. * * @return the current lang. * * @deprecated Deprecated as of 2.7.0. Use {@link Result} instead. */ @Deprecated public static Lang lang() { return Context.current().lang(); }
/** * Returns the current lang. */ public static Lang lang() { return Http.Context.current().lang(); }
/** * Returns the current lang. * * @return the language * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public static Lang lang() { return Http.Context.current().lang(); }
/** * Returns the current lang. * * @return the current lang. * * @deprecated Deprecated as of 2.7.0. Use {@link Result} instead. */ @Deprecated public static Lang lang() { return Context.current().lang(); }
/** * Returns the current lang. */ public static Lang lang() { return Context.current().lang(); }
/** * Returns the current lang. * * @return the language * * @deprecated Deprecated as of 2.7.0. <a href="https://www.playframework.com/documentation/latest/JavaHttpContextMigration27">See migration guide.</a>. */ @Deprecated public static Lang lang() { return Http.Context.current().lang(); }
/** * Returns the current lang. * * @return the current lang. * * @deprecated Deprecated as of 2.7.0. Use {@link Result} instead. */ @Deprecated public static Lang lang() { return Context.current().lang(); }