https://github.com/boldradius/Play_i18n_demo
There is some trick is :
1: Scala did not support Http Context.
The java extend controller call ctx().changeLang(language);
I could not find the similar code.
2: The template play.i18n Messages.get is deprecated. should use play.api.i18n Message
3: The controller should must use implicit request
def index() = Action.async { implicit request =>
Future.successful(Ok(views.html.index()))
}
4: For custom http handler there is no implicit request.
please give :
val currentLang = request.cookies.get("PLAY_LANG").get.valueval ipMessages: Messages = new Messages( Lang(currentLang), messagesApi)
That all message came from ipMessages that should be fine.
No comments:
Post a Comment