Skip to content

Instantly share code, notes, and snippets.

View teenasharma's full-sized avatar
🎯
Focusing

Teena Vashist teenasharma

🎯
Focusing
  • Expedia
View GitHub Profile
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))
}
@(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>
}