Skip to content

Commit e207d11

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 34337a4 commit e207d11

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
@@ -372,7 +372,7 @@ I18n.pluralRules = {
372372
* translations to a component's constructor
373373
*
374374
* @typedef {object} TranslationPluralised
375-
* @property {Translation} other - General plural form
375+
* @property {Translation} [other] - General plural form
376376
* @property {Translation} [zero] - Plural form used with 0
377377
* @property {Translation} [one] - Plural form used with 1
378378
* @property {Translation} [two] - Plural form used with 2

0 commit comments

Comments
 (0)