Skip to content

Commit

Permalink
fixed welsh bugs and sonar issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-cognizant committed Aug 9, 2024
1 parent e7b3c7e commit e2880fd
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 81 deletions.
4 changes: 4 additions & 0 deletions .sonarlint/connectedMode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sonarCloudOrganization": "defra",
"projectKey": "8a3e3fc5664ed1006f22cc2abfbdc42bf4208f91"
}
13 changes: 13 additions & 0 deletions src/client/assets/stylesheets/lang-toggle/_all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,17 @@
.govuk-main-wrapper.govuk-main-wrapper{
padding-top: 20px;
}

.govuk-main-wrapper.govuk-main-wrapper:has(.govuk-radios){
padding-top: 0;
}

.govuk-main-wrapper.govuk-main-wrapper:has(.govuk-list){
padding-top: 0;
}

.govuk-main-wrapper.govuk-main-wrapper:has(.govuk-grid-column-two-thirds-from-desktop.govuk-grid-column-full){
padding-top: 20px;
}


2 changes: 1 addition & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const config = convict({
doc: 'OS Name Places key',
format: '*',
sensitive: true,
default: '',
default: 'vvR3FiaNjSWCnFzSKBst23TX6efl0oL9',
env: 'OS_PLACES_API_KEY'
},
osPlacesApiUrl: {
Expand Down
19 changes: 6 additions & 13 deletions src/server/accessibility/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@ const accessibilityController = {
/* eslint-disable camelcase */
const {
footer: {
accessibility: {
paragraphs,
pageTitle,
title,
utm_source,
userId,
headings,
heading
}
accessibility: { paragraphs, pageTitle, title, headings, heading }
},
cookieBanner,
phaseBanner,
footerTxt,
multipleLocations: { serviceName }
} = english
const language = 'en'
const {
query: { lang }
query: { lang, utm_source, userId }
} = request
if (lang && lang === 'cy') {
return h.redirect('/hygyrchedd/cy')
return h.redirect(
`/hygyrchedd/cy?lang=${lang}&userId=${userId}&utm_source=${utm_source}`
)
}
return h.view('accessibility/index', {
userId,
Expand All @@ -40,7 +33,7 @@ const accessibilityController = {
footerTxt,
cookieBanner,
serviceName,
lang: lang ?? language
lang
})
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/server/accessibility/cy/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ const accessibilityController = {
const {
query: { lang, userId, utm_source }
} = request
const language = 'cy'
if (lang && lang === 'en') {
return h.redirect('/accessibility')
return h.redirect(
`/accessibility?lang=en&userId=${userId}&utm_source=${utm_source}`
)
}
return h.view('accessibility/index', {
userId,
Expand All @@ -32,7 +33,7 @@ const accessibilityController = {
footerTxt,
cookieBanner,
serviceName,
lang: lang ?? language
lang
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/accessibility/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<p class="govuk-body">{{paragraphs.c}}</p>

<h2 class="govuk-heading-m">{{haedings.b}}</h2>
<h2 class="govuk-heading-m">{{headings.b}}</h2>

<p class="govuk-body">{{paragraphs.d}}</p>
<p class="govuk-body">{{paragraphs.e}}</p>
Expand Down
11 changes: 7 additions & 4 deletions src/server/cookies/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ const cookiesController = {
multipleLocations: { serviceName }
} = english
/* eslint-disable camelcase */
const { query: lang, userId, utm_source } = request
const language = 'en'
const {
query: { lang, userId, utm_source }
} = request
if (lang && lang === 'cy') {
return h.redirect('/briwsion/cy')
return h.redirect(
`/briwsion/cy?lang=cy&userId=${userId}&utm_source=${utm_source}`
)
}
return h.view('cookies/index', {
userId,
Expand All @@ -40,7 +43,7 @@ const cookiesController = {
cookieBanner,
serviceName,
page: 'cookies',
lang: lang ?? language
lang
})
}
}
Expand Down
48 changes: 31 additions & 17 deletions src/server/cookies/cy/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,48 @@ import { welsh } from '~/src/server/data/cy/cy.js'
const cookiesController = {
handler: (request, h) => {
const {
footer: { cookies },
footer: {
cookies: {
pageTitle,
title,
heading,
headings,
table1,
table2,
paragraphs
}
},
cookieBanner,
phaseBanner,
footerTxt,
multipleLocations
multipleLocations: { serviceName }
} = welsh
const lang = 'cy'
const { query } = request
if (query?.lang && query?.lang === 'en') {
return h.redirect('/cookies')
/* eslint-disable camelcase */
const {
query: { lang, userId, utm_source }
} = request
if (lang && lang === 'en') {
return h.redirect(
`/cookies?lang=en&userId=${userId}&utm_source=${utm_source}`
)
}
return h.view('cookies/index', {
userId: query?.userId,
utm_source: query?.utm_source,
pageTitle: cookies.pageTitle,
title: cookies.title,
heading: cookies.heading,
headings: cookies.headings,
table1: cookies.table1,
table2: cookies.table2,
paragraphs: cookies.paragraphs,
userId,
utm_source,
pageTitle,
title,
heading,
headings,
table1,
table2,
paragraphs,
displayBacklink: false,
phaseBanner,
footerTxt,
cookieBanner,
serviceName: multipleLocations.serviceName,
serviceName,
page: 'cookies',
lang: query?.lang ?? lang
lang
})
}
}
Expand Down
31 changes: 15 additions & 16 deletions src/server/cookies/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
}) }}

<h1 class="govuk-heading-xl">{{title}}</h1>
<p class="govuk-body"><a href="/" class="govuk-link">{{paragraphs.a}}</a> {{paragraphs.b}}</p>

<p class="govuk-body">{{paragraphs.c}}</p>
<p class="govuk-body">{{paragraphs.a}} <a href="/" class="govuk-link">{{paragraphs.b}}</a> {{paragraphs.c}}</p>

<p class="govuk-body">{{paragraphs.d}}</p>

<p class="govuk-body">{{paragraphs.e}} <a href="https://ico.org.uk/for-the-public/online/cookies" class="govuk-link">{{paragraphs.f}}</a> {{paragraphs.g}}</p>
<p class="govuk-body">{{paragraphs.e}}</p>

<p class="govuk-body">{{paragraphs.f}} <a href="https://ico.org.uk/for-the-public/online/cookies" class="govuk-link">{{paragraphs.g}}</a> {{paragraphs.h}}</p>

<form class="js-cookies-page-form">

<h2 class="govuk-heading-m">{{headings.a}}</h2>

<p class="govuk-body">{{paragraphs.h}}</p>
<p class="govuk-body">{{paragraphs.i}}</p>

{{ govukTable({
firstCellIsHeader: true,
Expand All @@ -52,25 +52,24 @@

<h2 class="govuk-heading-m">{{headings.b}}</h2>

<p class="govuk-body">{{paragraphs.i}}</p>

<p class="govuk-body">{{paragraphs.j}}</p>

<p class="govuk-body">{{paragraphs.k}}</p>

<p class="govuk-body">{{paragraphs.l}}</p>

<p class="govuk-body">{{paragraphs.m}}</p>

<ul class="govuk-list govuk-list--bullet">
<li>{{paragraphs.m}}</li>
<li>{{paragraphs.n}}</li>
<li>{{paragraphs.o}}</li>
<li>{{paragraphs.p}}/li>
<li>t{{paragraphs.q}}</li>
<li>{{paragraphs.p}}</li>
<li>{{paragraphs.q}}</li>
<li>{{paragraphs.r}}</li>
</ul>

{{ govukTable({
firstCellIsHeader: true,
caption: headings.c,
caption: headings.d,
head: [
{ text: table2.text1 },
{ text: table2.text2 },
Expand All @@ -85,7 +84,7 @@
[
{ text: "_gid" },
{ text: table2.text7 },
{ text: table8.text8 }
{ text: table2.text8 }
],
[
{ text: "_gat_UA-[G-8CMZBTDQBC]" },
Expand All @@ -100,7 +99,7 @@
idPrefix: "cookies-analytics",
fieldset: {
legend: {
text: headings.d,
text: headings.e,
classes: "govuk-fieldset__legend--s"
},
classes: "js-cookies-page-form-fieldset",
Expand All @@ -111,11 +110,11 @@
},
items: [
{
text: paragraphs.r,
text: paragraphs.s,
value: "yes"
},
{
text: paragraphs.s,
text: paragraphs.t,
value: "no"
}
]
Expand Down
1 change: 1 addition & 0 deletions src/server/data/cy/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const WELSH_TITLE = 'Gwirio ansawdd aer lleol'
30 changes: 16 additions & 14 deletions src/server/data/cy/cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { WELSH_TITLE } from './constants'

export const welsh = {
checkLocalAirQuality: {
pageTitle: 'Gwirio ansawdd aer lleol - GOV.UK',
heading: 'Gwirio ansawdd aer lleol',
page: 'Gwirio ansawdd aer lleol',
heading: `${WELSH_TITLE}`,
page: `${WELSH_TITLE}`,
paragraphs: {
a: 'Defnyddiwch y gwasanaeth yma:',
b: 'i wirio ansawdd yr aer mewn ardal leol',
Expand Down Expand Up @@ -188,7 +190,7 @@ export const welsh = {
ozone: {
title: 'Osôn (O3)',
pageTitle: 'Ozone(O₃) – Check local air quality – GOV.UK',
headerText: 'Gwirio ansawdd aer lleol',
headerText: `${WELSH_TITLE}`,
headings: {
a: 'Ffynonellau osôn',
b: 'Effeithiau ar iechyd'
Expand All @@ -211,7 +213,7 @@ export const welsh = {
nitrogenDioxide: {
title: 'Nitrogen deuocsid (NO₂)',
pageTitle: 'Nitrogen deuocsid (NO₂) – Check local air quality – GOV.UK',
headerText: 'Gwirio ansawdd aer lleol',
headerText: `${WELSH_TITLE}`,
headings: {
a: 'Ffynonellau nitrogen deuocsid',
b: 'Effeithiau ar iechyd'
Expand All @@ -236,7 +238,7 @@ export const welsh = {
sulphurDioxide: {
title: 'Sylffwr deuocsid (SO₂)',
pageTitle: 'Sylffwr deuocsid (SO₂) – Gwirio ansawdd aer lleol – GOV.UK',
headerText: 'Gwirio ansawdd aer lleol',
headerText: `${WELSH_TITLE}`,
headings: {
a: 'Ffynonellau sylffwr deuocsid',
b: 'Effeithiau ar iechyd'
Expand All @@ -261,7 +263,7 @@ export const welsh = {
particulateMatter10: {
title: 'Mater gronynnol (PM10)',
pageTitle: 'Mater gronynnol (PM10) – Gwirio ansawdd aer lleol – GOV.UK',
headerText: 'Gwirio ansawdd aer lleol',
headerText: `${WELSH_TITLE}`,
headings: {
a: 'Ffynonellau PM10',
b: 'Effeithiau ar iechyd'
Expand Down Expand Up @@ -420,14 +422,13 @@ export const welsh = {
text7:
'Mae’n ein helpu i gyfrif faint o bobl sy’n ymweld â Gwirio ansawdd aer lleol trwy ddweud wrthon ni a ydych chi wedi ymweld o’r blaen. ',
text8: '24 awr',
text9: '_gat_UA-[GTM-WHV4RRMR]',
text10: 'Mae’n cael ei ddefnyddio i leihau nifer y ceisiadau.',
text11: '1 funud'
text9: 'Mae’n cael ei ddefnyddio i leihau nifer y ceisiadau.',
text10: '1 funud'
},
paragraphs: {
a: 'Mae',
b: 'Gwirio ansawdd aer lleol',
c: 'puts small files (known as ‘cookies’) on your computer.',
b: `${WELSH_TITLE}`,
c: 'yn rhoi ffeiliau bach (o’r enw ’cwcis’) ar eich cyfrifiadur. ',
d: 'Mae’r cwcis yma yn cael eu defnyddio ar draws gwefan Gwirio ansawdd aer lleol.',
e: 'Dim pan fydd JavaScript yn rhedeg yn eich porwr a phan fyddwch chi wedi’u derbyn y byddwn ni’n gosod cwcis. Os dewiswch chi beidio â rhedeg Javascript, fydd yr wybodaeth ar y tudalen yma ddim yn gymwys i chi.',
f: 'Darganfyddwch',
Expand All @@ -443,8 +444,8 @@ export const welsh = {
p: 'Sut gwnaethoch chi gyrraedd y wefan',
q: 'Beth rydych chi’n clicio arno wrth ymweld â’r wefan',
r: 'Y ddyfais a’r porwr rydych chi’n eu defnyddio',
s: 'Oes',
t: 'Nac ydw',
s: 'Hoffwn',
t: 'Na hoffwn',
buttonText: 'Cadw gosodiadau cwcis'
}
},
Expand All @@ -460,11 +461,12 @@ export const welsh = {
a: 'Mae Adran yr Amgylchedd, Bwyd a Materion Gwledig wedi ymrwymo i wneud ei gwefannau yn hygyrch yn unol â Rheoliadau Hygyrchedd Cyrff y Sector Cyhoeddus (Gwefannau a Chymwysiadau Symudol) (Rhif 2) 2018. ',
b: 'Mae’r datganiad hygyrchedd yma yn gymwys i',
c: 'Mae’r wefan yma yn cydymffurfio’n llawn â safon AA fersiwn 2.2 o Ganllawiau Hygyrchedd Cynnwys y We (WCAG).',

d: 'Cafodd y datganiad yma ei baratoi ar 20 Mawrth 2024.',
e: 'Cafodd y wefan ei gwerthuso gan Adran yr Amgylchedd, Bwyd a Materion Gwledig. ',
f: 'Y tro diwethaf i’r datganiad gael ei adolygu oedd 11 Mawrth 2024.',
g: 'Os byddwch yn sylwi ar unrhyw fethiannau cydymffurfiaeth neu os oes angen ichi ofyn am wybodaeth a chynnwys sydd heb gael eu darparu yn y ddogfen yma, anfonwch neges ebost at',
h: 'Y Comisiwn Cydraddoldeb a Hawliau Dynol (EHRC) sy’n gyfrifol am orfodi Rheoliadau Hygyrchedd Cyrff y Sector Cyhoeddus (Gwefannau a Chymwysiadau Symudol) (Rhif 2) 2018 (y ’rheoliadau hygyrchedd). ',
h: 'Y Comisiwn Cydraddoldeb a Hawliau Dynol (EHRC) sy’n gyfrifol am orfodi Rheoliadau Hygyrchedd Cyrff y Sector Cyhoeddus (Gwefannau a Chymwysiadau Symudol) (Rhif 2) 2018 (y ’rheoliadau hygyrchedd). ',
i: 'Os nad ydych chi’n fodlon ar y ffordd rydyn ni’n ymateb i’ch cwyn, cysylltwch â’r Gwasanaeth Cynghori a Chymorth Cydraddoldeb (EASS).'
}
}
Expand Down
Loading

0 comments on commit e2880fd

Please sign in to comment.