fix/df-1065: Fixed optional + welsh yes/no#438
Conversation
Scullyon
left a comment
There was a problem hiding this comment.
Sorry for all the comments, Jez!
I'm missing the context of why the temporary workaround is required - does it not translate in the standard way?
|
|
||
| // The question text may have already appended 'optional' in the relevant language | ||
| const optionalAlreadyAppended = pageTitle.endsWith( | ||
| ` ${t('common.optional')}` |
There was a problem hiding this comment.
Would it be better to cache the result of t('common.optional') just above here in a variable, so that it can be used here and below?
| i18nInstance.addResourceBundle(lng, 'form', resources, true, true) | ||
|
|
||
| // Temporary workaround - until we develop a better solution | ||
| const yesNoList = getYesNoList() |
There was a problem hiding this comment.
The getYesNoList() is called within a loop - does it need to be called each time?
| i18nInstance.addResource( | ||
| lng, | ||
| 'form', | ||
| `listItems.${yesNoList.items[0].id}.text`, |
There was a problem hiding this comment.
This is positional, would it be better to do it by ID?
import { yesNoListNoItemId, yesNoListYesItemId } from '@defra/forms-model'
// ...
i18nInstance.addResource(lng, 'form', `listItems.${yesNoListYesItemId}.text`, 'Ie')
i18nInstance.addResource(lng, 'form', `listItems.${yesNoListNoItemId}.text`, 'Nage')
| lng, | ||
| 'form', | ||
| `listItems.${yesNoList.items[1].id}.text`, | ||
| 'Nage' |
There was a problem hiding this comment.
Is it Nage or Na? Or even Naddo? Google Translate says Na for Yes/No and my favourite AI reckons it's context sensitive as to which of the three it might be 😂
There was a problem hiding this comment.
Yes, Alex asked his AI and the generic Yes/No was the options I've coded. It can change depending on context, hence the temporary fixed solution for now.
There was a problem hiding this comment.
Gemini tells me:
Welsh is famous for not having a single, universal word for "yes" or "no" because it usually repeats the verb used in the question. However, if you just need a generic, "catch-all" option for a quick message that people will understand, here is the best way to do it:
The Generic Option
Yes = Ie (pronounced ee-eh)
No = Nage (pronounced nah-geh, with a hard 'g')
…DEFRA/forms-engine-plugin into fix/df-1065-optional-and-yes-no
| "one": "Mae gennych %{count} nod ar ôl", | ||
| "other": "Mae gennych %{count} nod ar ôl" |
There was a problem hiding this comment.
can you just check the syntax for this? I notice in line 268 we use [[count]] whereas here we're using %{count}
| "one": "Mae gennych %{count} nod yn ormod", | ||
| "other": "Mae gennych %{count} nod yn ormod" |
|



Proposed change
Handles '(optional)' in page heading (compatible with translations)
Hard-codes Welsh Yes/No translation until we develop a better solution.
Handles payment description.
Jira ticket:
Type of change
Checklist
README.mdanddocs/*(where appropriate, e.g. new features).npm run test).npm run lint).npm run format).