Skip to content

Commit 0a679b8

Browse files
Ensure JSDoc plural form other is optional (with caveats)
See: #2921 Whilst `other` is required in English and is used as a fallback, it won’t be in all locales
1 parent 6f9fd78 commit 0a679b8

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/govuk/components/character-count/character-count.unit.test.mjs

+1-3
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,11 @@ describe('CharacterCount', () => {
9292
const component = new CharacterCount($div, {
9393
i18n: {
9494
charactersUnderLimit: {
95-
one: 'Different custom text. Count: %{count}',
96-
other: 'Different custom text. Count: %{count}'
95+
one: 'Different custom text. Count: %{count}'
9796
}
9897
}
9998
})
10099
expect(component.formatCountMessage(1, 'characters')).toEqual('Custom text. Count: 1')
101-
expect(component.formatCountMessage(10, 'characters')).toEqual('Different custom text. Count: 10')
102100
// Other keys remain untouched
103101
expect(component.formatCountMessage(-10, 'characters')).toEqual('You have 10 characters too many')
104102
expect(component.formatCountMessage(0, 'characters')).toEqual('You have 0 characters remaining')

src/govuk/i18n.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ I18n.pluralRules = {
364364
* translations to a component's constructor
365365
*
366366
* @typedef {object} TranslationPluralForms
367-
* @property {string} other - General plural form
367+
* @property {string} [other] - General plural form
368368
* @property {string} [zero] - Plural form used with 0
369369
* @property {string} [one] - Plural form used with 1
370370
* @property {string} [two] - Plural form used with 2

0 commit comments

Comments
 (0)