Skip to content

Commit b75ad8f

Browse files
authored
Remove Welsh language feature toggle (#2311)
* Remove Welsh language feature toggle https://eaflood.atlassian.net/browse/IWTF-3776 Whilst developing the bilingual site, we had a feature toggle to hide it on production. Now it’s gone live, this feature toggle should be removed. * remove from server.js * remove from misc-routes * remove from readme * remove from env vars
1 parent 808d593 commit b75ad8f

File tree

11 files changed

+45
-97
lines changed

11 files changed

+45
-97
lines changed

docker/env/gafl_webapp.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ DEBUG=webapp:*
3030
# ANALYTICS_PRIMARY_PROPERTY=G-DJMSHRPMW8 // this is the non-prod tracking update as required
3131
# GTM_CONTAINER_ID=GTM-ABC1234
3232

33-
# Welsh language feature switch
34-
SHOW_WELSH_CONTENT=true
35-
3633
# Error handler feature switch
3734
ERROR_PAGE_ROUTE=false
3835

packages/gafl-webapp-service/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ To run from this directory:
3535
| SERVICE_PAGE | GOV.UK service page | no | https://www.gov.uk/fishing-licences/buy-a-fishing-licence | |
3636
| AIRBRAKE_HOST | URL of airbrake host | no | | |
3737
| AIRBRAKE_PROJECT_KEY | Project key for airbrake logging | no | | |
38-
| SHOW_WELSH_CONTENT | Display option to change to welsh language | no | | |
3938
| ENABLE_ANALYTICS_OPT_IN_DEBUGGING | Set log if analytics been checked in non-production | no | | |
4039
| ERROR_PAGE_ROUTE | Display error pages to support welsh language | no | | |
4140
| SHOW_CANCELLATION_JOURNEY | Display option to show recurring payments cancellation journey | no | | |

packages/gafl-webapp-service/src/__tests__/__snapshots__/plugin.spec.js.snap renamed to packages/gafl-webapp-service/src/__tests__/__snapshots__/plugins.spec.js.snap

File renamed without changes.

packages/gafl-webapp-service/src/__tests__/plugin.spec.js

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { getPlugins } from '../plugins'
2+
3+
jest.mock('../constants', () => ({
4+
CommonResults: {
5+
OK: 'ok'
6+
},
7+
ShowDigitalLicencePages: {
8+
YES: 'show-digital-licence-yes'
9+
}
10+
}))
11+
12+
jest.mock('../server.js', () => ({
13+
getCsrfTokenCookieName: jest.fn()
14+
}))
15+
jest.mock('debug', () => jest.fn(() => jest.fn()))
16+
17+
describe('plugins', () => {
18+
describe('initialiseHapiI18nPlugin', () => {
19+
it('should configure i18n for English and Welsh', () => {
20+
const hapI18nPlugin = getPlugins().find(plugin => plugin?.plugin?.plugin?.name === 'hapi-i18n')
21+
22+
expect(hapI18nPlugin.options.locales).toStrictEqual(['en', 'cy'])
23+
expect(hapI18nPlugin.options.queryParameter).toBe('lang')
24+
})
25+
})
26+
27+
describe('initialiseBlankiePlugin', () => {
28+
it('should return expecetd src details', async () => {
29+
const blankiePlugin = getPlugins().find(plugin => plugin?.plugin?.plugin?.pkg?.name === 'blankie')
30+
expect(blankiePlugin.options).toMatchSnapshot()
31+
})
32+
})
33+
})

packages/gafl-webapp-service/src/__tests__/server.spec.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,6 @@ describe('The server', () => {
164164
expect(request.response.source.context._uri.queryParams).toStrictEqual({ lang: 'cy' })
165165
})
166166

167-
it.each([
168-
['true', true],
169-
['TRUE', true],
170-
['false', false],
171-
['FALSE', false]
172-
])(
173-
'if SHOW_WELSH_CONTENT is %s, it should set SHOW_WELSH_CONTENT to %s in the response',
174-
(inputShowWelshContent, outputShowWelshContent) => {
175-
process.env.SHOW_WELSH_CONTENT = inputShowWelshContent
176-
const request = getSampleRequest()
177-
layoutContextAmalgamation(request, {})
178-
expect(request.response.source.context.SHOW_WELSH_CONTENT).toBe(outputShowWelshContent)
179-
}
180-
)
181-
182167
it.each([
183168
['cookies', 'cookies.url', 'COOKIES'],
184169
['refunds', 'refunds.url', 'REFUND_POLICY'],

packages/gafl-webapp-service/src/pages/layout/layout.njk

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,16 @@
142142
</span>
143143
</p>
144144
</div>
145-
{% if SHOW_WELSH_CONTENT %}
146-
<div class="govuk-width-container govuk-!-display-none-print govuk-!-margin-top-2">
147-
<p class="govuk-body-s right-align govuk-!-margin-0">
148-
{% if _uri.queryParams.lang == 'cy' %}
149-
<a class="govuk-link govuk-!-margin-2" href="?lang=en" hreflang="en" lang="en">English</a> | <span class="govuk-body-s govuk-!-margin-2">Cymraeg</span>
150-
{% else %}
151-
<span class="govuk-body-s govuk-!-margin-2">English</span> | <a class="govuk-link govuk-!-margin-2" href="?lang=cy" hreflang="cy" lang="cy" rel="alternate">Cymraeg</a>
152-
{% endif%}
153-
</p>
154-
</div>
155-
{% endif%}
145+
146+
<div class="govuk-width-container govuk-!-display-none-print govuk-!-margin-top-2">
147+
<p class="govuk-body-s right-align govuk-!-margin-0">
148+
{% if _uri.queryParams.lang == 'cy' %}
149+
<a class="govuk-link govuk-!-margin-2" href="?lang=en" hreflang="en" lang="en">English</a> | <span class="govuk-body-s govuk-!-margin-2">Cymraeg</span>
150+
{% else %}
151+
<span class="govuk-body-s govuk-!-margin-2">English</span> | <a class="govuk-link govuk-!-margin-2" href="?lang=cy" hreflang="cy" lang="cy" rel="alternate">Cymraeg</a>
152+
{% endif %}
153+
</p>
154+
</div>
156155
{% endif %}
157156
{% if backRef %}
158157
{{ govukBackLink({

packages/gafl-webapp-service/src/plugins.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ const initialiseCrumbPlugin = () => ({
6666
})
6767

6868
const initialiseHapiI18nPlugin = () => {
69-
const showWelshContent = process.env.SHOW_WELSH_CONTENT?.toLowerCase() === 'true'
7069
return {
7170
plugin: HapiI18n,
7271
options: {
73-
locales: ['en', ...(showWelshContent ? ['cy'] : [])],
72+
locales: ['en', 'cy'],
7473
directory: path.join(Dirname, 'src/locales'),
75-
...(showWelshContent && { queryParameter: 'lang' })
74+
queryParameter: 'lang'
7675
}
7776
}
7877
}

packages/gafl-webapp-service/src/routes/__tests__/misc-routes-handlers.spec.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -318,26 +318,6 @@ describe('guidance page handlers', () => {
318318
)
319319
})
320320

321-
it.each([
322-
['true', true],
323-
['false', false],
324-
[undefined, false]
325-
])('returns SHOW_WELSH_CONTENT correctly based on env variable', async (showWelsh, expected) => {
326-
process.env.SHOW_WELSH_CONTENT = showWelsh
327-
328-
const request = getMockRequest()
329-
const toolkit = getMockToolkit()
330-
331-
await cookiesPagePostHandler(request, toolkit)
332-
333-
expect(toolkit.view).toHaveBeenCalledWith(
334-
expect.any(String),
335-
expect.objectContaining({
336-
SHOW_WELSH_CONTENT: expected
337-
})
338-
)
339-
})
340-
341321
it.each([['csrf_token_cookie_name'], ['any_name'], ['token_cookie']])(
342322
'sets CSRF_TOKEN_NAME to match process.env.CSRF_TOKEN_COOKIE_NAME',
343323
async csrf => {

packages/gafl-webapp-service/src/routes/misc-routes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ export default [
153153
return h.view(COOKIES.page, {
154154
...cookiesView(request, analyticsCache),
155155
showNotification,
156-
SHOW_WELSH_CONTENT: process.env.SHOW_WELSH_CONTENT?.toLowerCase() === 'true',
157156
CSRF_TOKEN_NAME: process.env.CSRF_TOKEN_COOKIE_NAME || CSRF_TOKEN_COOKIE_NAME_DEFAULT,
158157
CSRF_TOKEN_VALUE: csrfToken
159158
})

0 commit comments

Comments
 (0)