playframework - Play Framework config value in JavaScript -


Is it possible to access play config value in JavaScript? Especially the current lang has been selected to know? (V2.2.3)

Edit:

More specifically, I want to localize the components on the client side, and let me know Required Lang is used to render the page in that Drama Javascript file.

:

On the first request of a new user, the default language will be estimated to use Play. This does this by parse HTTP accept-language header, it will then save the chosen language in the PLAY_LANG cookie, then the next request will use the same language.

For some reason I do not see this cookie in the customer side.

My question is) Is there any other way to know Play's lang on the client side? B) Why is this cookie not working? Take a look at

. Application Configuration () .asMap () or configuration is one of the other methods of the class. You can read about this about

After getting the settings you are interested in them, you can serve them via HTML / JS, but you have to do it manually .

But I'm not sure if you mean that the current lang which is selected means it is play-stateless, the language depends on customer's request. In contrast, the values ​​of your configuration are fixed, e.g. application.langs .

Edit:

The best possible long of a controller was determined (and this Type is "current language"), maybe you want.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -