Merge pull request #170 from plone/i18n-reuse-existing-translation

Reuse existing translation for the "Save" button in the Edit comment form.
This commit is contained in:
Vincent Fretin 2020-06-18 13:05:32 +02:00 committed by GitHub
commit e1a433956e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

2
news/170.bugfix Normal file
View File

@ -0,0 +1,2 @@
Reuse existing translation for the "Save" button in the Edit comment form.
[vincentfretin]

View File

@ -75,7 +75,7 @@ class EditCommentForm(CommentForm):
target = portal_state.portal_url()
self.request.response.redirect(target)
@button.buttonAndHandler(_(u'edit_comment_form_button',
@button.buttonAndHandler(_(u'label_save',
default=u'Save'), name='comment')
def handleComment(self, action):

View File

@ -29,6 +29,7 @@ _('Recall')
_('Approve')
_('Reject')
_('Spam')
PMF = _
class TranslationHelper(BrowserView):
@ -37,7 +38,8 @@ class TranslationHelper(BrowserView):
return _(text)
def translate_comment_review_state(self, rs):
return _("comment_" + rs, default=rs)
# use PMF instead of _ here so i18ndude doesn't extract "comment_"
return PMF("comment_" + rs, default=rs)
class View(BrowserView):