julienrf / play-jsmessages

Library to compute localized messages of your Play application on client side

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how do i update the language that the lpjs library uses

geetee24 opened this issue · comments

using yor library.

class Application @Inject() ( jsMessagesFactory: JsMessagesFactory, val messagesApi: MessagesApi ) extends Controller with I18nSupport {

val messages = jsMessagesFactory.all
val jsMessages = Action { implicit request => Ok( messages( Some( "window.Messages" ) ) ) }

then I change the language to say french.
then how do I tell your 'messages' to be in french and not the defualt language.
thanks

Hi, did you read the corresponding documentation? https://www.playframework.com/documentation/2.4.x/ScalaI18N

it did not provide an answer. can you please provide it

Hi, as explained here: https://github.com/julienrf/play-jsmessages/blob/master/README.md#-for-all-the-languages
You have to pass the language you want to use as a parameter of the generated JavaScript function.

thanks but I didnt want to send all languages down to the browser. hence I wanted the fix to be in your library.

OK, in that case just follow the instructions in this section: https://github.com/julienrf/play-jsmessages#-for-the-clients-preferred-language