externalize comment length warning

pull/53/head
Zlatin Balevsky 2020-11-03 19:41:41 +00:00
parent 08f0f8400d
commit 3a1eafb203
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 6 additions and 2 deletions

View File

@ -14,6 +14,8 @@ import com.muwire.core.Core
import com.muwire.core.files.UICommentEvent import com.muwire.core.files.UICommentEvent
import com.muwire.core.util.DataUtil import com.muwire.core.util.DataUtil
import static com.muwire.gui.Translator.trans
@ArtifactProviderFor(GriffonController) @ArtifactProviderFor(GriffonController)
class AddCommentController { class AddCommentController {
@MVCMember @Nonnull @MVCMember @Nonnull
@ -27,8 +29,8 @@ class AddCommentController {
void save() { void save() {
String comment = view.textarea.getText() String comment = view.textarea.getText()
if (comment.length() > Constants.MAX_COMMENT_LENGTH ) { if (comment.length() > Constants.MAX_COMMENT_LENGTH ) {
JOptionPane.showMessageDialog(null, "Your comment is too long - ${comment.length()} bytes. The maximum size is $Constants.MAX_COMMENT_LENGTH bytes", JOptionPane.showMessageDialog(null, trans("ADD_COMMENT_TOO_LONG_BODY", comment.length(), Constants.MAX_COMMENT_LENGTH),
"Comment Too Long", JOptionPane.WARNING_MESSAGE) trans("ADD_COMMENT_TOO_LONG"), JOptionPane.WARNING_MESSAGE)
return return
} }
if (comment.trim().length() == 0) if (comment.trim().length() == 0)

View File

@ -422,6 +422,8 @@ CLEAR_HITS=Clear Hits
## Add comment frame ## Add comment frame
ADD_COMMENT_MULTIPLE=Add comment to multiple files ADD_COMMENT_MULTIPLE=Add comment to multiple files
ADD_COMMENT_SINGLE=Add comment to {0} ADD_COMMENT_SINGLE=Add comment to {0}
ADD_COMMENT_TOO_LONG=Comment too long
ADD_COMMENT_TOO_LONG_BODY=Your comment is too long - {0} characters. The maximum length is {1} characters.
## Browse dialog ## Browse dialog