diff --git a/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js b/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js index 14cf8ecfc..0517caf0f 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js @@ -1,9 +1,25 @@ import React, {PropTypes} from 'react'; import styles from './CommentCount.css'; +import I18n from 'coral-framework/modules/i18n/i18n'; +import translations from 'coral-admin/src/translations.json'; +const lang = new I18n(translations); -const CommentCount = props => ( - {props.count} -); +const CommentCount = ({count}) => { + let number = count; + + // shorten large counts to abbreviations + if (number / 1e9 > 1) { + number = `${(number / 1e9).toFixed(1)}${lang.t('modqueue.billion')}`; + } else if (number / 1e6 > 1) { + number = `${(number / 1e6).toFixed(1)}${lang.t('modqueue.million')}`; + } else if (number / 1e3 > 1) { + number = `${(number / 1e3).toFixed(1)}${lang.t('modqueue.thousand')}`; + } + + return ( + {number} + ); +}; CommentCount.propTypes = { count: PropTypes.number.isRequired diff --git a/client/coral-admin/src/translations.json b/client/coral-admin/src/translations.json index 6401f4990..3f9392656 100644 --- a/client/coral-admin/src/translations.json +++ b/client/coral-admin/src/translations.json @@ -63,7 +63,10 @@ "impersonating": "Impersonating", "offensive": "Offensive", "spam/ads": "Spam/Ads", - "other": "Other" + "other": "Other", + "thousand": "k", + "million": "M", + "billion": "B" }, "comment": { "flagged": "flagged", @@ -248,7 +251,10 @@ "impersonating": "Suplantación", "offensive": "Ofensivo", "spam/ads": "Spam/Propaganda", - "other": "Otros" + "other": "Otros", + "thousand": "m", + "million": "M", + "billion": "B" }, "comment": { "flagged": "marcado", diff --git a/package.json b/package.json index 250c0549f..bfca21643 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "talk", - "version": "1.5.0", + "version": "1.6.0", "description": "A better commenting experience from Mozilla, The New York Times, and the Washington Post. https://coralproject.net", "main": "app.js", "scripts": {