Skip to content

Commit

Permalink
Adds translate explanation
Browse files Browse the repository at this point in the history
Add a tiny bit of explanation about translating your form
  • Loading branch information
Anke authored Jan 14, 2019
1 parent 872cb1e commit 4c94f96
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: `<p class="boltform-info boltform-message">{{ info }}</p>`

into this: `<p class="boltform-info boltform-message">{{ l(info) }}</p>`

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

0 comments on commit 4c94f96

Please sign in to comment.