Skip to content

Commit

Permalink
Fix definition of alternativeLang in creating links
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Mar 11, 2019
1 parent 47337c1 commit 98614ea
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/views/documentation/Helpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"""<a href="$url">${version.toString}</a>""")
}

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))
}

Expand Down

0 comments on commit 98614ea

Please sign in to comment.