You can use the play.mvc.Controllersuperclass method for this .
Then you need to tell your language resolver which domain uses the language in which we default, using application.confor database entries for this. Further, depending on what you want to achieve, simply use the global class to intercept all of your request or create a simple action that will change the language and they will return to one page (so that the user can decide which language he wants to use).
- , cookie, , (.. ). , , , ;)
:
.
public Action onRequest(final Http.Request request, final Method actionMethod) {
if (request.host().equals("de.yourdomain.tld")
&& (request.cookie("PLAY_LANG") == null || !request.cookie("PLAY_LANG").value().equals("de"))) {
return new Action.Simple() {
public Result call(Http.Context ctx) throws Throwable {
ctx.changeLang("de");
return redirect(request.path());
}
};
} else {
return super.onRequest(request, actionMethod);
}
}
, de lang application.conf, . PLAY_LANG Play cookie .