Skip to content

Commit bdbaef3

Browse files
authored
Merge pull request #274 from anketwokings/4.2
Some explanation on translations and messages
2 parents 741e2c1 + 4c94f96 commit bdbaef3

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

docs/templates.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ e.g.:
135135
subject: my_sub_directory/subject.twig
136136
files: my_sub_directory/file_browser.twig
137137
form_theme: my_sub_directory/_form_theme.twig
138+
messages: my_sub_directory/_messages.twig
138139
```
139140
140141
You can override the form templates for all your forms in the top of config. To do this,
@@ -201,6 +202,32 @@ create your own email.twig template. To start, you can copy and edit the include
201202

202203
Success, error, and debug messages can all be found in the following blocks
203204
messages_info, messages_error, and messages_debug. You can display the messages
204-
by viewing `templates/feedback/_messages.twig` for reference.
205+
by viewing `templates/feedback/_messages.twig` for reference. If you want to edit
206+
the feedback and messages template, be sure to override them in the config using:
207+
208+
```yaml
209+
templates:
210+
messages: my_sub_directory/_messages.twig
211+
```
212+
213+
214+
215+
### Translation
216+
217+
**NOTE: Install the Translate and Labels extension for this**
218+
219+
If you want to use multilanguage in your forms, be sure to install both the
220+
`Translate` and `Labels` extensions in your site. The Translate extension has a template
221+
overriding the default form and adding translatable labels. [See the Translate docs for this][translate]
222+
223+
To translate the messages edit the `_messages.twig` template as below:
224+
225+
change this: `<p class="boltform-info boltform-message">{{ info }}</p>`
226+
227+
into this: `<p class="boltform-info boltform-message">{{ l(info) }}</p>`
228+
229+
This adds all feedback messages to your labels.yml to translate.
230+
205231

206232
[customize]: http://symfony.com/doc/current/cookbook/form/form_customization.html
233+
[translate]: https://bolttranslate.github.io/Translate/configuration.html

0 commit comments

Comments
 (0)