Skip to content

Commit

Permalink
fix(i18n): regression in Trans
Browse files Browse the repository at this point in the history
Latest i18next-icu uses upstream intl-messageformat for plurals,
unfortunately it means we no longer can mix tags with plurals in Trans
element. This is a cosmetic fix that makes entire label a link.
  • Loading branch information
lidel committed Feb 26, 2021
1 parent 5984715 commit f1dcc07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions public/locales/en/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"pieChartLabel": "{count, plural, one {{percent}% ({count} Peer)} other {{percent}% ({count} Peers)}}",
"countMore": "...and {count} more",
"StatusConnected": {
"paragraph1": "Hosting <0>{repoSize} of files</0>",
"paragraph2": "{count, plural, one {Discovered <0>1 peer</0>} other {Discovered <0>{peersCount} peers</0>}}"
"repoSize": "Hosting {repoSize} of data",
"peersCount": "{peersCount, plural, one {Discovered 1 peer} other {Discovered {peersCount} peers}}"
},
"customApiConfig": "Custom JSON configuration",
"AskToEnable": {
Expand Down
18 changes: 6 additions & 12 deletions src/status/StatusConnected.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,15 @@ export const StatusConnected = ({ t, peersCount, repoSize }) => {
</h1>
<p className='montserrat fw4 f5 ma0 pb3 lh-copy'>
<span className='db dib-ns'>
<Trans
i18nKey='StatusConnected.paragraph1' t={t}
defaults='Hosting <0>{repoSize} of files</0>'
values={{ repoSize: humanRepoSize }}
components={[<a className='link blue' href='#/files'>?</a>]}
/>
<a className='link blue' href='#/files'>
{t('StatusConnected.repoSize', { repoSize: humanRepoSize })}
</a>
</span>
<span className='dn di-ns gray'></span>
<span className='db mt1 mt0-ns dib-ns'>
<Trans
i18nKey='StatusConnected.paragraph2' t={t}
defaults='Discovered <0>{peersCount} peers</0>'
values={{ peersCount: peersCount.toString() }}
components={[<a className='link blue' href='#/peers'>?</a>]}
/>
<a className='link blue' href='#/peers'>
{t('StatusConnected.peersCount', { peersCount: peersCount.toString() })}
</a>
</span>
</p>
</header>
Expand Down

0 comments on commit f1dcc07

Please sign in to comment.