diff options
10 files changed, 54 insertions, 48 deletions
diff --git a/webapp/components/add_users_to_team/add_users_to_team.jsx b/webapp/components/add_users_to_team/add_users_to_team.jsx index 691323568..34ad6eb0d 100644 --- a/webapp/components/add_users_to_team/add_users_to_team.jsx +++ b/webapp/components/add_users_to_team/add_users_to_team.jsx @@ -201,7 +201,7 @@ export default class AddUsersToTeam extends React.Component { const numRemainingText = ( <FormattedMessage id='multiselect.numPeopleRemaining' - defaultMessage='You can add {num, number} more {num, plural, =0 {people} one {person} other {people}}. ' + defaultMessage='You can add {num, number} more {num, plural, one {person} other {people}}. ' values={{ num: MAX_SELECTABLE_VALUES - this.state.values.length }} diff --git a/webapp/components/admin_console/system_users/system_users_list.jsx b/webapp/components/admin_console/system_users/system_users_list.jsx index c567fd43c..bca80428b 100644 --- a/webapp/components/admin_console/system_users/system_users_list.jsx +++ b/webapp/components/admin_console/system_users/system_users_list.jsx @@ -180,7 +180,7 @@ export default class SystemUsersList extends React.Component { return ( <FormattedMessage id='system_users_list.countSearch' - defaultMessage='{count, number} {count, plural, one {user} other {users}} of {total} total' + defaultMessage='{count, number} {count, plural, one {user} other {users}} of {total, number} total' values={{ count, total @@ -191,7 +191,7 @@ export default class SystemUsersList extends React.Component { return ( <FormattedMessage id='system_users_list.countPage' - defaultMessage='{startCount, number} - {endCount, number} {count, plural, one {user} other {users}} of {total} total' + defaultMessage='{startCount, number} - {endCount, number} {count, plural, one {user} other {users}} of {total, number} total' values={{ count, startCount: startCount + 1, diff --git a/webapp/components/delete_post_modal.jsx b/webapp/components/delete_post_modal.jsx index a64c466cc..fc7e24f22 100644 --- a/webapp/components/delete_post_modal.jsx +++ b/webapp/components/delete_post_modal.jsx @@ -87,7 +87,7 @@ export default class DeletePostModal extends React.Component { commentWarning = ( <FormattedMessage id='delete_post.warning' - defaultMessage='This post has {count} comment(s) on it.' + defaultMessage='This post has {count, number} {count, plural, one {comment} other {comments}} on it.' values={{ count: this.state.commentCount }} diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx index 07aa43a99..6b36e83fb 100644 --- a/webapp/components/file_upload.jsx +++ b/webapp/components/file_upload.jsx @@ -17,7 +17,7 @@ import {uploadFile} from 'actions/file_actions.jsx'; const holders = defineMessages({ limited: { id: 'file_upload.limited', - defaultMessage: 'Uploads limited to {count} files maximum. Please use additional posts for more files.' + defaultMessage: 'Uploads limited to {count, number} files maximum. Please use additional posts for more files.' }, filesAbove: { id: 'file_upload.filesAbove', @@ -94,13 +94,13 @@ class FileUpload extends React.Component { const clientId = Utils.generateId(); const request = uploadFile( - files[i], - files[i].name, - channelId, - clientId, - this.fileUploadSuccess.bind(this, channelId), - this.fileUploadFail.bind(this, clientId) - ); + files[i], + files[i].name, + channelId, + clientId, + this.fileUploadSuccess.bind(this, channelId), + this.fileUploadFail.bind(this, clientId) + ); const requests = this.state.requests; requests[clientId] = request; diff --git a/webapp/components/filtered_user_list.jsx b/webapp/components/filtered_user_list.jsx index cddbc762e..3a7190b2d 100644 --- a/webapp/components/filtered_user_list.jsx +++ b/webapp/components/filtered_user_list.jsx @@ -138,7 +138,7 @@ class FilteredUserList extends React.Component { count = ( <FormattedMessage id='filtered_user_list.count' - defaultMessage='{count} {count, plural, =0 {0 members} one {member} other {members}}' + defaultMessage='{count, number} {count, plural, one {member} other {members}}' values={{ count: users.length }} @@ -148,7 +148,7 @@ class FilteredUserList extends React.Component { count = ( <FormattedMessage id='filtered_user_list.countTotal' - defaultMessage='{count} {count, plural, =0 {0 members} one {member} other {members}} of {total} Total' + defaultMessage='{count, number} {count, plural, one {member} other {members}} of {total, number} total' values={{ count: users.length, total: this.state.users.length diff --git a/webapp/components/more_direct_channels/more_direct_channels.jsx b/webapp/components/more_direct_channels/more_direct_channels.jsx index 8b5b6d65c..8b4a105b4 100644 --- a/webapp/components/more_direct_channels/more_direct_channels.jsx +++ b/webapp/components/more_direct_channels/more_direct_channels.jsx @@ -285,7 +285,7 @@ export default class MoreDirectChannels extends React.Component { const numRemainingText = ( <FormattedMessage id='multiselect.numPeopleRemaining' - defaultMessage='You can add {num, number} more {num, plural, =0 {people} one {person} other {people}}. ' + defaultMessage='You can add {num, number} more {num, plural, one {person} other {people}}. ' values={{ num: MAX_SELECTABLE_VALUES - this.state.values.length }} diff --git a/webapp/components/post_view/commented_on_files_message/commented_on_files_message.jsx b/webapp/components/post_view/commented_on_files_message/commented_on_files_message.jsx index a09b2b156..a8c6845c8 100644 --- a/webapp/components/post_view/commented_on_files_message/commented_on_files_message.jsx +++ b/webapp/components/post_view/commented_on_files_message/commented_on_files_message.jsx @@ -1,9 +1,9 @@ // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import PropTypes from 'prop-types'; import React from 'react'; - -import * as Utils from 'utils/utils.jsx'; +import {FormattedMessage} from 'react-intl'; export default class CommentedOnFilesMessage extends React.PureComponent { static propTypes = { @@ -11,19 +11,19 @@ export default class CommentedOnFilesMessage extends React.PureComponent { /* * The id of the post that was commented on */ - parentPostId: React.PropTypes.string.isRequired, + parentPostId: PropTypes.string.isRequired, /* * An array of file metadata for the parent post */ - fileInfos: React.PropTypes.arrayOf(React.PropTypes.object), + fileInfos: PropTypes.arrayOf(PropTypes.object), - actions: React.PropTypes.shape({ + actions: PropTypes.shape({ /* * Function to get file metadata for a post */ - getFilesForPost: React.PropTypes.func.isRequired + getFilesForPost: PropTypes.func.isRequired }).isRequired } @@ -34,18 +34,28 @@ export default class CommentedOnFilesMessage extends React.PureComponent { } render() { - let message = ' '; - - if (this.props.fileInfos && this.props.fileInfos.length > 0) { - message = this.props.fileInfos[0].name; + if (!this.props.fileInfos || this.props.fileInfos.length === 0) { + return null; + } - if (this.props.fileInfos.length === 2) { - message += Utils.localizeMessage('post_body.plusOne', ' plus 1 other file'); - } else if (this.props.fileInfos.length > 2) { - message += Utils.localizeMessage('post_body.plusMore', ' plus {count} other files').replace('{count}', (this.props.fileInfos.length - 1).toString()); - } + let plusMore = null; + if (this.props.fileInfos.length > 1) { + plusMore = ( + <FormattedMessage + id='post_body.plusMore' + defaultMessage=' plus {count, number} other {count, plural, one {file} other {files}}' + values={{ + count: this.props.fileInfos.length + }} + /> + ); } - return <span>{message}</span>; + return ( + <span> + {this.props.fileInfos[0].name} + {plusMore} + </span> + ); } } diff --git a/webapp/components/searchable_user_list/searchable_user_list.jsx b/webapp/components/searchable_user_list/searchable_user_list.jsx index dae7835ac..e936ed25f 100644 --- a/webapp/components/searchable_user_list/searchable_user_list.jsx +++ b/webapp/components/searchable_user_list/searchable_user_list.jsx @@ -135,7 +135,7 @@ export default class SearchableUserList extends React.Component { return ( <FormattedMessage id='filtered_user_list.countTotal' - defaultMessage='{count} {count, plural, =0 {0 members} one {member} other {members}} of {total} total' + defaultMessage='{count, number} {count, plural, one {member} other {members}} of {total, number} total' values={{ count, total @@ -147,7 +147,7 @@ export default class SearchableUserList extends React.Component { return ( <FormattedMessage id='filtered_user_list.countTotalPage' - defaultMessage='{startCount, number} - {endCount, number} {count, plural, =0 {0 members} one {member} other {members}} of {total} total' + defaultMessage='{startCount, number} - {endCount, number} {count, plural, one {member} other {members}} of {total, number} total' values={{ count, startCount: startCount + 1, diff --git a/webapp/components/view_image_popover_bar.jsx b/webapp/components/view_image_popover_bar.jsx index f07eb19fb..88055b47b 100644 --- a/webapp/components/view_image_popover_bar.jsx +++ b/webapp/components/view_image_popover_bar.jsx @@ -42,7 +42,7 @@ export default class ViewImagePopoverBar extends React.Component { <span className='pull-left text'> <FormattedMessage id='view_image_popover.file' - defaultMessage='File {count} of {total}' + defaultMessage='File {count, number} of {total, number}' values={{ count: (this.props.fileId + 1), total: this.props.totalFiles diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index c43d03b53..fba6174e5 100755 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -1269,7 +1269,7 @@ "delete_post.del": "Delete", "delete_post.post": "Post", "delete_post.question": "Are you sure you want to delete this {term}?", - "delete_post.warning": "This post has {count} comment(s) on it.", + "delete_post.warning": "This post has {count, number} {count, plural, one {comment} other {comments}} on it.", "edit_channel_header.editHeader": "Edit the Channel Header...", "edit_channel_header.previewHeader": "Edit header", "edit_channel_header_modal.cancel": "Cancel", @@ -1350,16 +1350,13 @@ "file_upload.disabled": "File attachments are disabled.", "file_upload.fileAbove": "File above {max}MB cannot be uploaded: {filename}", "file_upload.filesAbove": "Files above {max}MB cannot be uploaded: {filenames}", - "file_upload.limited": "Uploads limited to {count} files maximum. Please use additional posts for more files.", + "file_upload.limited": "Uploads limited to {count, number} files maximum. Please use additional posts for more files.", "file_upload.pasted": "Image Pasted at ", - "filtered_channels_list.count": "{count} {count, plural, =0 {0 channels} one {channel} other {channels}}", - "filtered_channels_list.countTotal": "{count} {count, plural, =0 {0 channels} one {channel} other {channels}} of {total} total", "filtered_channels_list.search": "Search channels", "filtered_user_list.any_team": "All Users", - "filtered_user_list.count": "{count} {count, plural, =0 {0 members} one {member} other {members}}", - "filtered_user_list.countPage": "{startCount, number} - {endCount, number} {count, plural, =0 {0 members} one {member} other {members}}", - "filtered_user_list.countTotal": "{count} {count, plural, =0 {0 members} one {member} other {members}} of {total} total", - "filtered_user_list.countTotalPage": "{startCount, number} - {endCount, number} {count, plural, =0 {0 members} one {member} other {members}} of {total} total", + "filtered_user_list.count": "{count, number} {count, plural, one {member} other {members}}", + "filtered_user_list.countTotal": "{count, number} {count, plural, one {member} other {members}} of {total, number} total", + "filtered_user_list.countTotalPage": "{startCount, number} - {endCount, number} {count, plural, one {member} other {members}} of {total, number} total", "filtered_user_list.member": "Member", "filtered_user_list.next": "Next", "filtered_user_list.prev": "Previous", @@ -1803,7 +1800,7 @@ "multiselect.add": "Add", "multiselect.go": "Go", "multiselect.instructions": "Use up/down arrows to navigate and enter to select", - "multiselect.numPeopleRemaining": "You can add {num, number} more {num, plural, =0 {people} one {person} other {people}}. ", + "multiselect.numPeopleRemaining": "You can add {num, number} more {num, plural, one {person} other {people}}. ", "multiselect.numRemaining": "You can add {num, number} more", "multiselect.placeholder": "Search and add members", "navbar.addMembers": "Add Members", @@ -1869,8 +1866,7 @@ "post_attachment.more": "Show more...", "post_body.commentedOn": "Commented on {name}{apostrophe} message: ", "post_body.deleted": "(message deleted)", - "post_body.plusMore": " plus {count} other files", - "post_body.plusOne": " plus 1 other file", + "post_body.plusMore": " plus {count, number} other {count, plural, one {file} other {files}}", "post_delete.notPosted": "Comment could not be posted", "post_delete.okay": "Okay", "post_delete.someone": "Someone deleted the message on which you tried to post a comment.", @@ -2074,8 +2070,8 @@ "suggestion.search.private": "Private Channels", "suggestion.search.public": "Public Channels", "system_users_list.count": "{count, number} {count, plural, one {user} other {users}}", - "system_users_list.countPage": "{startCount, number} - {endCount, number} {count, plural, one {user} other {users}} of {total} total", - "system_users_list.countSearch": "{count, number} {count, plural, one {user} other {users}} of {total} total", + "system_users_list.countPage": "{startCount, number} - {endCount, number} {count, plural, one {user} other {users}} of {total, number} total", + "system_users_list.countSearch": "{count, number} {count, plural, one {user} other {users}} of {total, number} total", "team_export_tab.download": "download", "team_export_tab.export": "Export", "team_export_tab.exportTeam": "Export your team", @@ -2444,7 +2440,7 @@ "user_profile.webrtc.unavailable": "New call unavailable until your existing call ends", "view_image.loading": "Loading ", "view_image_popover.download": "Download", - "view_image_popover.file": "File {count} of {total}", + "view_image_popover.file": "File {count, number} of {total, number}", "view_image_popover.publicLink": "Get Public Link", "web.footer.about": "About", "web.footer.help": "Help", |