I’m working with getting javascript localization to work my play 2.0 app using twitter bootstrap and jquery with Jquery UI. The localization I’m aiming at requires messages for the validation plugin, datepicker etc.
AFAIK this requires me to include a javascript file with the localized messages for the validation and setting the datepicker.regional[‘XX’]. So I need to get the currently selected locale of the ones offered by the play application (configured in the application.conf file using the application.langs property), and use this in my template to include the correct localized file, something like this:
<script src="@routes.Assets.at("javascripts/i18n/messages_<locale>.js")"></script>
Is this the best/only solution? How can I get the currently selected locale from play framework?
I asked for controller cause Java passes
langand Scala does not, anyway, solution for you is: