This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MySupportController @Inject()(component: ControllerComponents, | |
langs: Langs) extends AbstractController(component) with I18nSupport { | |
val lang: Lang = langs.availables.head | |
implicit val messages: Messages = MessagesImpl(lang, messagesApi) | |
def index = Action { implicit request => | |
val messages: Messages = messagesApi.preferred(request) // get the messages for the given request | |
val message: String = messages("default.message") | |
Ok(views.html.index(message)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(message: String, style: String = "scala")(implicit messages: MessagesProvider) | |
@defining(play.core.PlayVersion.current) { version => | |
<section> | |
<div class="wrapper"> | |
@if(messages.messages.lang.language.equals("en")) { | |
<a class = "button" href="@routes.MySupportController.homePageInFrench()">fr</a> | |
} else { | |
<a class = "button" href="@routes.MySupportController.homePageWithDefaultLang()">en</a> | |
} |