3

I want to use i18n in my Play-Application (Play 2.1, Scala). The chosen language is stored in the PLAY_LANG-Cookie, but unfortunately this cookie is httpOnly. That means I can't read its value in my JavaScript files.

I tried changing the httpOnly-Value in the application.conf, but it didn't work.

application.session.httpOnly=false

I haven't found anything on this yet, so I'd really appreciate some help!

Govind Singh
  • 15,282
  • 14
  • 72
  • 106

2 Answers2

1

you can pass it to your scala template in the samy way we do with session

@(implicit session:play.api.mvc.Session, lang:play.api.i18n.Lang)

now you can pass @lang.code to the javscript. does the same functianlity but by diffrent approach.

Govind Singh
  • 15,282
  • 14
  • 72
  • 106
0

The configuration key has been renamed to session.httpOnly. I didn't find anything about this from recent documentation though. So in you application.conf:

session.httpOnly=false

juho
  • 41
  • 3