From 872cb1e2f68a539f5514121e9ee289efb15796c4 Mon Sep 17 00:00:00 2001 From: Anke Date: Mon, 14 Jan 2019 15:13:09 +0100 Subject: [PATCH 1/2] Add 'messages' template to overrides Was missing: how to override the messages template --- docs/templates.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/templates.md b/docs/templates.md index ac92754..00fc396 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -135,6 +135,7 @@ e.g.: subject: my_sub_directory/subject.twig files: my_sub_directory/file_browser.twig form_theme: my_sub_directory/_form_theme.twig + messages: my_sub_directory/_messages.twig ``` You can override the form templates for all your forms in the top of config. To do this, From 4c94f966b1c1a7d24797b263f3d8e8fd1bd899ba Mon Sep 17 00:00:00 2001 From: Anke Date: Mon, 14 Jan 2019 15:53:51 +0100 Subject: [PATCH 2/2] Adds translate explanation Add a tiny bit of explanation about translating your form --- docs/templates.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/templates.md b/docs/templates.md index 00fc396..397eca4 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -202,6 +202,32 @@ create your own email.twig template. To start, you can copy and edit the include Success, error, and debug messages can all be found in the following blocks messages_info, messages_error, and messages_debug. You can display the messages -by viewing `templates/feedback/_messages.twig` for reference. +by viewing `templates/feedback/_messages.twig` for reference. If you want to edit +the feedback and messages template, be sure to override them in the config using: + +```yaml +templates: + messages: my_sub_directory/_messages.twig +``` + + + +### Translation + +**NOTE: Install the Translate and Labels extension for this** + +If you want to use multilanguage in your forms, be sure to install both the +`Translate` and `Labels` extensions in your site. The Translate extension has a template +overriding the default form and adding translatable labels. [See the Translate docs for this][translate] + +To translate the messages edit the `_messages.twig` template as below: + +change this: `

{{ info }}

` + +into this: `

{{ l(info) }}

` + +This adds all feedback messages to your labels.yml to translate. + [customize]: http://symfony.com/doc/current/cookbook/form/form_customization.html +[translate]: https://bolttranslate.github.io/Translate/configuration.html