Skip to content

Commit

Permalink
Merge pull request #1615 from ministryofjustice/MLPAB-2554-mirror-mirror
Browse files Browse the repository at this point in the history


MLPAB-2554 Remove language switch on error pages
  • Loading branch information
hawx authored Nov 12, 2024
2 parents 39c9665 + 18f8c60 commit fcd834e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
3 changes: 3 additions & 0 deletions cypress/e2e/error-pages.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ describe('Error pages', () => {
it('shows for 404s', () => {
cy.visit('/not-a-real-page', { failOnStatusCode: false });
cy.contains('Page not found');
cy.contains('Welsh').should('not.exist');
cy.checkA11yApp();

cy.visit('/lpa', { failOnStatusCode: false });
Expand All @@ -19,6 +20,7 @@ describe('Error pages', () => {
cy.visitLpa('/payment-confirmation', { failOnStatusCode: false });

cy.contains('Sorry, there is a problem with the service');
cy.contains('Welsh').should('not.exist');
cy.checkA11yApp();
});

Expand All @@ -32,5 +34,6 @@ describe('Error pages', () => {
cy.contains('button', 'Save and continue').click();

cy.contains('Sorry, there is a problem with the service');
cy.contains('Welsh').should('not.exist');
});
});
1 change: 1 addition & 0 deletions web/template/error-500.gohtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{ template "page" . }}

{{ define "pageTitle" }}{{ tr .App "sorryProblem" }}{{ end }}
{{ define "languageSwitch" }}<!-- Removing this comment will make the switch show, so don't -->{{ end }}

{{ define "main" }}
<div class="govuk-grid-row">
Expand Down
30 changes: 16 additions & 14 deletions web/template/layout/page.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,22 @@
<a class="govuk-back-link" href="#">Back</a>
{{ end }}

<ul class="trans-switch app-hide-print" id="language-switch" aria-label="Change your language">
<li class="govuk-list trans-switch__list govuk-body-s" id="language-switch-en" lang="en-gb">
{{ if isWelsh .App.Lang }}<a href="{{ .App.Path }}{{ .App.EncodeQuery }}" class="govuk-link"><span class="govuk-visually-hidden">Change language to </span>{{ end }}
{{ if isEnglish .App.Lang }}<span class="govuk-visually-hidden">Current language is </span>{{ end }}
English
{{ if isWelsh .App.Lang }}</a>{{ end }}
</li>
<li class="govuk-list trans-switch__list govuk-body-s" id="language-switch-cy" lang="cy-gb">
{{ if isEnglish .App.Lang }}<a href="/cy{{ .App.Path }}{{ .App.EncodeQuery }}" class="govuk-link" aria-label="Newid iaith i'r Gymraeg">{{ end }}
Cymraeg
{{ if isEnglish .App.Lang }}</a>{{ end }}
{{ if isWelsh .App.Lang }}<span class="govuk-visually-hidden"> yw'r iaith bresennol</span>{{ end }}
</li>
</ul>
{{ block "languageSwitch" . }}
<ul class="trans-switch app-hide-print" id="language-switch" aria-label="Change your language">
<li class="govuk-list trans-switch__list govuk-body-s" id="language-switch-en" lang="en-gb">
{{ if isWelsh .App.Lang }}<a href="{{ .App.Path }}{{ .App.EncodeQuery }}" class="govuk-link"><span class="govuk-visually-hidden">Change language to </span>{{ end }}
{{ if isEnglish .App.Lang }}<span class="govuk-visually-hidden">Current language is </span>{{ end }}
English
{{ if isWelsh .App.Lang }}</a>{{ end }}
</li>
<li class="govuk-list trans-switch__list govuk-body-s" id="language-switch-cy" lang="cy-gb">
{{ if isEnglish .App.Lang }}<a href="/cy{{ .App.Path }}{{ .App.EncodeQuery }}" class="govuk-link" aria-label="Newid iaith i'r Gymraeg">{{ end }}
Cymraeg
{{ if isEnglish .App.Lang }}</a>{{ end }}
{{ if isWelsh .App.Lang }}<span class="govuk-visually-hidden"> yw'r iaith bresennol</span>{{ end }}
</li>
</ul>
{{ end }}
</div>

<main class="govuk-main-wrapper app-main-class" id="main-content" role="main">
Expand Down

0 comments on commit fcd834e

Please sign in to comment.