From 98614ea586adb1fa7c62cb05eec29a35624271f1 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 11 Mar 2019 09:41:08 +0000 Subject: [PATCH] Fix definition of alternativeLang in creating links --- app/views/documentation/Helpers.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/documentation/Helpers.scala b/app/views/documentation/Helpers.scala index 8ed15d34..f35c1bca 100644 --- a/app/views/documentation/Helpers.scala +++ b/app/views/documentation/Helpers.scala @@ -18,8 +18,9 @@ object Helpers { def displayVersionMessage( page: String, )(implicit messagesApi: MessagesApi, context: TranslationContext, reverseRouter: ReverseRouter): Html = { - implicit val lang = context.alternateLang.getOrElse(Lang.defaultLang) - val version = context.version.get + implicit val alternateLang = context.alternateLang + implicit val lang = context.alternateLang.getOrElse(Lang.defaultLang) + val version = context.version.get if (isDevelopmentVersion(version)) { upgrade(unstableMessage(link(version, page)), page) } else { @@ -85,16 +86,17 @@ object Helpers { private def link( version: Version, page: String, - )(implicit alternateLang: Lang, reverseRouter: ReverseRouter): Html = { - val url = reverseRouter.page(Option(alternateLang), version.toString, page) + )(implicit alternateLang: Option[Lang], reverseRouter: ReverseRouter): Html = { + val url = reverseRouter.page(alternateLang, version.toString, page) Html(s"""${version.toString}""") } private def displayUpgradeMessage( page: String, )(implicit messagesApi: MessagesApi, context: TranslationContext, reverseRouter: ReverseRouter): Html = { - val version = latestCurrent.get - implicit val lang = context.alternateLang.getOrElse(Lang.defaultLang) + val version = latestCurrent.get + implicit val alternateLang = context.alternateLang + implicit val lang = context.alternateLang.getOrElse(Lang.defaultLang) currentLatestMessage(link(version, page)) }