Skip to content

Commit

Permalink
Updated 0 board to 0 boards (singular vs plural) (#1210)
Browse files Browse the repository at this point in the history
* Updated 0 board to 0 boards (singular vs plural

* Made text translatable

* Used better i18n for singular-plural

* Updated tests

* Minor fixes

* done

* Lint fix

* Updated tests
  • Loading branch information
harshilsharma63 committed Sep 22, 2021
1 parent c27a270 commit 4ca8c69
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions webapp/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"GalleryCard.delete": "Delete",
"GalleryCard.duplicate": "Duplicate",
"GroupBy.ungroup": "Ungroup",
"General.BoardCount": "{count, plural, one {# Board} other {# Boards}}",
"KanbanCard.delete": "Delete",
"KanbanCard.duplicate": "Duplicate",
"KanbanCard.untitled": "Untitled",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ exports[`components/workspaceSwitcher/WorkspaceOptions 2 more workspaces availab
<div
class="boardCount"
>
2
Boards
2 Boards
</div>
</div>
<div
Expand All @@ -112,9 +110,7 @@ exports[`components/workspaceSwitcher/WorkspaceOptions 2 more workspaces availab
<div
class="boardCount"
>
3
Boards
3 Boards
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ exports[`components/workspaceSwitcher/WorkspaceSwitcher 2 more workspaces availa
<div
class="boardCount"
>
2
Boards
2 Boards
</div>
</div>
<div
Expand All @@ -112,9 +110,7 @@ exports[`components/workspaceSwitcher/WorkspaceSwitcher 2 more workspaces availa
<div
class="boardCount"
>
3
Boards
3 Boards
</div>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions webapp/src/components/workspaceSwitcher/workspaceOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react'

import Select from 'react-select'
import {useIntl} from 'react-intl'
import {FormattedMessage, useIntl} from 'react-intl'

import {UserWorkspace} from '../../user'
import {useAppSelector} from '../../store/hooks'
Expand Down Expand Up @@ -102,7 +102,11 @@ const Option = (props: any): JSX.Element => {
{
props.data.value !== DashboardOption.value &&
<div className='boardCount'>
{props.data.boardCount} {props.data.boardCount > 1 ? 'Boards' : 'Board'}
<FormattedMessage
values={{count: props.data.boardCount}}
id='General.BoardCount'
defaultMessage='{count, plural, one {# Board} other {# Boards}}'
/>
</div>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`pages/dashboard/CenterContent base case 1`] = `
<div
class="small"
>
1 board
1 Board
</div>
</div>
<div
Expand All @@ -61,7 +61,7 @@ exports[`pages/dashboard/CenterContent base case 1`] = `
<div
class="small"
>
2 boards
2 Boards
</div>
</div>
<div
Expand All @@ -75,7 +75,7 @@ exports[`pages/dashboard/CenterContent base case 1`] = `
<div
class="small"
>
0 board
0 Boards
</div>
</div>
</div>
Expand Down Expand Up @@ -211,7 +211,7 @@ exports[`pages/dashboard/CenterContent search filter 1`] = `
<div
class="small"
>
1 board
1 Board
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ exports[`pages/dashboard/DashboardPage base case 1`] = `
<div
class="small"
>
1 board
1 Board
</div>
</div>
<div
Expand All @@ -375,7 +375,7 @@ exports[`pages/dashboard/DashboardPage base case 1`] = `
<div
class="small"
>
2 boards
2 Boards
</div>
</div>
<div
Expand All @@ -389,7 +389,7 @@ exports[`pages/dashboard/DashboardPage base case 1`] = `
<div
class="small"
>
0 board
0 Boards
</div>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions webapp/src/pages/dashboard/centerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {useEffect, useState} from 'react'

import {useHistory} from 'react-router-dom'

import {useIntl} from 'react-intl'
import {FormattedMessage, useIntl} from 'react-intl'

import SearchIllustration from '../../svg/search-illustration'

Expand Down Expand Up @@ -87,7 +87,11 @@ const DashboardCenterContent = (): JSX.Element => {
{workspace.title}
</div>
<div className='small'>
{`${workspace.boardCount} board${workspace.boardCount > 1 ? 's' : ''}`}
<FormattedMessage
values={{count: workspace.boardCount}}
id='General.BoardCount'
defaultMessage='{count, plural, one {# Board} other {# Boards}}'
/>
</div>
</div>
))
Expand Down

0 comments on commit 4ca8c69

Please sign in to comment.