diff --git a/frontend/app/components/comment-form/comment-form.tsx b/frontend/app/components/comment-form/comment-form.tsx index 04ba61d724..50cc5492b3 100644 --- a/frontend/app/components/comment-form/comment-form.tsx +++ b/frontend/app/components/comment-form/comment-form.tsx @@ -72,6 +72,18 @@ const messages = defineMessages({ id: 'commentForm.uploading-file', defaultMessage: 'uploading {fileName}...', }, + exceededSize: { + id: 'commentForm.exceeded-size', + defaultMessage: '{fileName} exceeds size limit of {maxImageSize}', + }, + newComment: { + id: 'commentForm.new-comment', + defaultMessage: 'New comment', + }, + unexpectedError: { + id: 'commentForm.unexpected-error', + defaultMessage: 'Something went wrong. Please try again a bit later.', + }, }); export class CommentForm extends Component { @@ -282,7 +294,12 @@ export class CommentForm extends Component { const placeholderStart = this.state.text.length === 0 ? '' : '\n'; if (file.size > StaticStore.config.max_image_size) { - this.appendError(`${file.name} exceeds size limit of ${maxImageSizeString}`); + this.appendError( + intl.formatMessage(messages.exceededSize, { + fileName: file.name, + maxImageSize: maxImageSizeString, + }) + ); continue; } @@ -327,7 +344,12 @@ export class CommentForm extends Component { }; if (file.size > StaticStore.config.max_image_size) { - this.appendError(`${file.name} exceeds size limit of ${maxImageSizeString}`); + this.appendError( + intl.formatMessage(messages.exceededSize, { + fileName: file.name, + maxImageSize: maxImageSizeString, + }) + ); continue; } @@ -367,7 +389,8 @@ export class CommentForm extends Component { reply: , }; const label = buttonText || Labels[props.mode || 'main']; - const placeholderMessage = this.props.intl.formatMessage(messages.placeholder); + const intl = this.props.intl; + const placeholderMessage = intl.formatMessage(messages.placeholder); return (
{ mix: props.mix, })} onSubmit={this.send} - aria-label="New comment" + aria-label={intl.formatMessage(messages.newComment)} onDragOver={this.onDragOver} onDrop={this.onDrop} > @@ -413,7 +436,7 @@ export class CommentForm extends Component { {(isErrorShown || !!errorMessage) && - (errorMessage || 'Something went wrong. Please try again a bit later.').split('\n').map(e => ( + (errorMessage || intl.formatMessage(messages.unexpectedError)).split('\n').map(e => (

{e}

@@ -455,8 +478,8 @@ export class CommentForm extends Component { {StaticStore.config.email_notifications && ( - {' or '} - + {' '} + )} diff --git a/frontend/app/locales/en.json b/frontend/app/locales/en.json index 33a8666d6e..4177b69ec6 100644 --- a/frontend/app/locales/en.json +++ b/frontend/app/locales/en.json @@ -73,5 +73,9 @@ "comment.vote-error": "Voting error: {voteErrorMessage}", "commentForm.upload-file-fail": "{fileName} upload failed with \"{errorMessage}\"", "commentForm.uploading": "Uploading...", - "commentForm.uploading-file": "uploading {fileName}..." + "commentForm.uploading-file": "uploading {fileName}...", + "commentForm.exceeded-size": "{fileName} exceeds size limit of {maxImageSize}", + "commentForm.new-comment": "New comment", + "commentForm.unexpected-error": "Something went wrong. Please try again a bit later.", + "commentForm.subscribe-or": "or" } diff --git a/frontend/app/locales/ru.json b/frontend/app/locales/ru.json index abd9a1d47b..8325b8d5d3 100644 --- a/frontend/app/locales/ru.json +++ b/frontend/app/locales/ru.json @@ -73,5 +73,9 @@ "comment.vote-error": "Ошибка голосования: {voteErrorMessage}", "commentForm.upload-file-fail": "{fileName} невозможно загрузить из-за ошибки: \"{errorMessage}\"", "commentForm.uploading": "Загрузка...", - "commentForm.uploading-file": "Загрузка {fileName}..." + "commentForm.uploading-file": "Загрузка {fileName}...", + "commentForm.exceeded-size": "Размер файла {fileName} должен быть меньше чем {maxImageSize}", + "commentForm.new-comment": "New comment", + "commentForm.unexpected-error": "Something went wrong. Please try again a bit later.", + "commentForm.subscribe-or": "или" }