Allow translating the comments form
This commit is contained in:
parent
3919f7d764
commit
9d38761d44
|
@ -117,7 +117,6 @@ class CommentsPlugin extends Plugin
|
|||
$this->enable([
|
||||
'onTwigTemplatePaths' => ['onTwigAdminTemplatePaths', 0],
|
||||
'onAdminMenu' => ['onAdminMenu', 0],
|
||||
'onAdminTemplateNavPluginHook' => ['onAdminMenu', 0], //DEPRECATED
|
||||
'onDataTypeExcludeFromDataManagerPluginHook' => ['onDataTypeExcludeFromDataManagerPluginHook', 0],
|
||||
]);
|
||||
|
||||
|
|
|
@ -12,23 +12,23 @@ form:
|
|||
name: comments
|
||||
fields:
|
||||
- name: name
|
||||
label: Name
|
||||
placeholder: Enter your name
|
||||
label: PLUGIN_COMMENTS.NAME_LABEL
|
||||
placeholder: PLUGIN_COMMENTS.NAME_PLACEHOLDER
|
||||
autocomplete: on
|
||||
type: text
|
||||
validate:
|
||||
required: true
|
||||
|
||||
- name: email
|
||||
label: Email
|
||||
placeholder: Enter your email address
|
||||
label: PLUGIN_COMMENTS.EMAIL_LABEL
|
||||
placeholder: PLUGIN_COMMENTS.EMAIL_PLACEHOLDER
|
||||
type: email
|
||||
validate:
|
||||
required: true
|
||||
|
||||
- name: text
|
||||
label: Message
|
||||
placeholder: Enter your message
|
||||
label: PLUGIN_COMMENTS.MESSAGE_LABEL
|
||||
placeholder: PLUGIN_COMMENTS.MESSAGE_PLACEHOLDER
|
||||
type: textarea
|
||||
validate:
|
||||
required: true
|
||||
|
@ -62,15 +62,15 @@ form:
|
|||
|
||||
buttons:
|
||||
- type: submit
|
||||
value: Submit
|
||||
value: PLUGIN_COMMENTS.SUBMIT_COMMENT_BUTTON_TEXT
|
||||
|
||||
process:
|
||||
- email:
|
||||
subject: "[New Comment] from {{ form.value.name|e }}"
|
||||
subject: PLUGIN_COMMENTS.EMAIL_NEW_COMMENT_SUBJECT
|
||||
body: "{% include 'forms/data.html.twig' %}"
|
||||
# - captcha:
|
||||
# recatpcha_secret: ej32oiej23oiej32oijeoi32jeio32je
|
||||
- addComment:
|
||||
- message: Thank you for writing your comment!
|
||||
- message: PLUGIN_COMMENTS.THANK_YOU_MESSAGE
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,16 @@ en:
|
|||
EMAIL: Email:
|
||||
WRITTEN_ON: Written on
|
||||
BY: by
|
||||
NAME_LABEL: "Name"
|
||||
NAME_PLACEHOLDER: "Enter your name"
|
||||
EMAIL_LABEL: "Email"
|
||||
EMAIL_PLACEHOLDER: "Enter your email address"
|
||||
MESSAGE_LABEL: "Comment"
|
||||
MESSAGE_PLACEHOLDER: "Enter your comment"
|
||||
SUBMIT_COMMENT_BUTTON_TEXT: "Submit"
|
||||
EMAIL_NEW_COMMENT_SUBJECT: "[New Comment] from {{ form.value.name|e }}"
|
||||
THANK_YOU_MESSAGE: "Thank you for writing your comment!"
|
||||
|
||||
fr:
|
||||
PLUGIN_COMMENTS:
|
||||
ADD_COMMENT: Ajouter un commentaire
|
||||
|
@ -34,6 +44,16 @@ it:
|
|||
EMAIL: Email:
|
||||
WRITTEN_ON: Scritto il
|
||||
BY: da
|
||||
NAME_LABEL: "Nome"
|
||||
NAME_PLACEHOLDER: "Inserisci il tuo nome"
|
||||
EMAIL_LABEL: "Email"
|
||||
EMAIL_PLACEHOLDER: "Inserisci il tuo indirizzo email"
|
||||
MESSAGE_LABEL: "Messaggio"
|
||||
MESSAGE_PLACEHOLDER: "Inserisci il tuo commento"
|
||||
SUBMIT_COMMENT_BUTTON_TEXT: "Invia"
|
||||
EMAIL_NEW_COMMENT_SUBJECT: "[Nuovo commento] da {{ form.value.name|e }}"
|
||||
THANK_YOU_MESSAGE: "Grazie per il tuo commento!"
|
||||
|
||||
ru:
|
||||
PLUGIN_COMMENTS:
|
||||
ADD_COMMENT: Добавить комментарий
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
<form name="{{ grav.config.plugins.comments.form.name }}"
|
||||
action="{{ grav.config.plugins.comments.form.action ? base_url ~ grav.config.plugins.comments.form.action : page.url }}"
|
||||
method="{{ grav.config.plugins.comments.form.method|upper|default('POST') }}">
|
||||
{% for field in grav.config.plugins.comments.form.fields %}
|
||||
|
||||
{% set value = form.value(field.name) %}
|
||||
{% if field.evaluateDefault %}
|
||||
{% set value = evaluate(field.evaluateDefault) %}
|
||||
{% endif %}
|
||||
<div>
|
||||
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for field in grav.config.plugins.comments.form.fields %}
|
||||
{% set value = form.value(field.name) %}
|
||||
{% if field.evaluateDefault %}
|
||||
{% set value = evaluate(field.evaluateDefault) %}
|
||||
{% endif %}
|
||||
<div>
|
||||
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="buttons">
|
||||
{% for button in grav.config.plugins.comments.form.buttons %}
|
||||
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|default('Submit') }}</button>
|
||||
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|t|default('Submit') }}</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue