Skip to content

Commit

Permalink
Plat UI 2566 translate default back link (#259)
Browse files Browse the repository at this point in the history
PLATUI-2566: Added Welsh translations for BackLink as breaking change
  • Loading branch information
JoPintoPaul committed Oct 30, 2023
1 parent 4a55049 commit 33bc604
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 115 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
For compatibility information see `govukFrontendVersion` and `hmrcFrontendVersion` in
[LibDependencies](project/LibDependencies.scala)

## [7.24.0] - 2023-10-30

### Changed

- Added Welsh translation of `Back` to `GovukBackLink`
- Require an implicit instance of `Messages` to be passed through the `GovukBackLink` component
- Uplifted version of `hmrc-frontend` to `5.51.0`

### Compatible with

- [hmrc/hmrc-frontend v5.51.0](https://github.com/hmrc/hmrc-frontend/releases/tag/v5.51.0)
- [alphagov/govuk-frontend v4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0)

## [7.23.0] - 2023-10-09

### Changed
Expand Down
2 changes: 1 addition & 1 deletion project/LibDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sbt.ModuleID

object LibDependencies {
val govukFrontendVersion: String = "4.7.0"
val hmrcFrontendVersion: String = "5.49.0"
val hmrcFrontendVersion: String = "5.51.0"
val playLanguageVersion: String = "6.2.0"

val compile: Seq[ModuleID] = dependencies(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,33 @@
package uk.gov.hmrc.govukfrontend.views
package components

import play.twirl.api.HtmlFormat
import uk.gov.hmrc.support.ScalaCheckUtils.ClassifyParams
import uk.gov.hmrc.govukfrontend.support.TemplateIntegrationSpec
import uk.gov.hmrc.govukfrontend.views.GovukFrontendDependency.govukFrontendVersion
import uk.gov.hmrc.govukfrontend.views.html.components._
import uk.gov.hmrc.govukfrontend.views.viewmodels.backlink.BackLink
import uk.gov.hmrc.govukfrontend.views.viewmodels.backlink.Generators._
import uk.gov.hmrc.helpers.MessagesSupport
import uk.gov.hmrc.support.TemplateIntegrationBaseSpec

import scala.collection.compat.immutable.LazyList
import scala.util.Try

object GovukBackLinkIntegrationSpec
extends TemplateIntegrationSpec[BackLink, GovukBackLink](govukComponentName = "govukBackLink", seed = None) {
extends TemplateIntegrationBaseSpec[BackLink](
componentName = "govukBackLink",
seed = None
)
with MessagesSupport {

protected val libraryName: String = "govuk"

protected val libraryVersion: String = govukFrontendVersion

private val component = app.injector.instanceOf[GovukBackLink]

override def render(notificationBanner: BackLink): Try[HtmlFormat.Appendable] =
Try(component(notificationBanner))

override def classifiers(backLink: BackLink): LazyList[ClassifyParams] =
(backLink.href.isEmpty, "empty href", "non-empty href") #::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

@this()

@(params: BackLink)
@(params: BackLink)(implicit messages: Messages)
@import params._
<a href="@{"#".?:(href)}" class="@toClasses("govuk-back-link", classes)"@toAttributes(attributes)>@content match {
case NonEmptyHtml(html) => {@html}
case NonEmptyText(text) => {@text}
case _ => {Back}
case _ => {@messages("back.text")}
}</a>

Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.46.0
5.51.0
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@
package uk.gov.hmrc.govukfrontend.views
package components

import play.api.mvc.RequestHeader
import play.api.test.FakeRequest
import play.twirl.api.HtmlFormat
import uk.gov.hmrc.govukfrontend.views.html.components._
import uk.gov.hmrc.helpers.MessagesSupport

class GovukBackLinkSpec extends TemplateUnitSpec[BackLink, GovukBackLink]("govukBackLink") {
import scala.util.Try

class GovukBackLinkSpec extends TemplateUnitBaseSpec[BackLink]("govukBackLink") with MessagesSupport {

private val component = app.injector.instanceOf[GovukBackLink]

def render(templateParams: BackLink): Try[HtmlFormat.Appendable] = Try(component(templateParams))

"backLink" should {
"render the default example with an anchor, href and text correctly" in {
Expand Down

0 comments on commit 33bc604

Please sign in to comment.