@@ -159,75 +159,76 @@ the message inside your :ref:`templates <translation-tags>`.
159159
160160.. _translation-real-vs-keyword-messages :
161161
162- .. sidebar :: Using Real or Keyword Messages
162+ Using Real or Keyword Messages
163+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163164
164- This example illustrates the two different philosophies when creating
165- messages to be translated::
165+ This example illustrates the two different philosophies when creating
166+ messages to be translated::
166167
167- $translator->trans('Symfony is great');
168+ $translator->trans('Symfony is great');
168169
169- $translator->trans('symfony.great');
170+ $translator->trans('symfony.great');
170171
171- In the first method, messages are written in the language of the default
172- locale (English in this case). That message is then used as the "id"
173- when creating translations.
172+ In the first method, messages are written in the language of the default
173+ locale (English in this case). That message is then used as the "id"
174+ when creating translations.
174175
175- In the second method, messages are actually "keywords" that convey the
176- idea of the message. The keyword message is then used as the "id" for
177- any translations. In this case, translations must be made for the default
178- locale (i.e. to translate ``symfony.great `` to ``Symfony is great ``).
176+ In the second method, messages are actually "keywords" that convey the
177+ idea of the message. The keyword message is then used as the "id" for
178+ any translations. In this case, translations must be made for the default
179+ locale (i.e. to translate ``symfony.great `` to ``Symfony is great ``).
179180
180- The second method is handy because the message key won't need to be changed
181- in every translation file if you decide that the message should actually
182- read "Symfony is really great" in the default locale.
181+ The second method is handy because the message key won't need to be changed
182+ in every translation file if you decide that the message should actually
183+ read "Symfony is really great" in the default locale.
183184
184- The choice of which method to use is entirely up to you, but the "keyword"
185- format is often recommended for multi-language applications, whereas for
186- shared bundles that contain translation resources we recommend the real
187- message, so your application can choose to disable the translator layer
188- and you will see a readable message.
185+ The choice of which method to use is entirely up to you, but the "keyword"
186+ format is often recommended for multi-language applications, whereas for
187+ shared bundles that contain translation resources we recommend the real
188+ message, so your application can choose to disable the translator layer
189+ and you will see a readable message.
189190
190- Additionally, the ``php `` and ``yaml `` file formats support nested ids to
191- avoid repeating yourself if you use keywords instead of real text for your
192- ids:
191+ Additionally, the ``php `` and ``yaml `` file formats support nested ids to
192+ avoid repeating yourself if you use keywords instead of real text for your
193+ ids:
193194
194- .. configuration-block ::
195+ .. configuration-block ::
195196
196- .. code-block :: yaml
197+ .. code-block :: yaml
197198
198- symfony :
199- is :
200- # id is symfony.is.great
201- great : Symfony is great
202- # id is symfony.is.amazing
203- amazing : Symfony is amazing
204- has :
205- # id is symfony.has.bundles
206- bundles : Symfony has bundles
207- user :
208- # id is user.login
209- login : Login
199+ symfony :
200+ is :
201+ # id is symfony.is.great
202+ great : Symfony is great
203+ # id is symfony.is.amazing
204+ amazing : Symfony is amazing
205+ has :
206+ # id is symfony.has.bundles
207+ bundles : Symfony has bundles
208+ user :
209+ # id is user.login
210+ login : Login
210211
211- .. code-block :: php
212+ .. code-block :: php
212213
213- [
214- 'symfony' => [
215- 'is' => [
216- // id is symfony.is.great
217- 'great' => 'Symfony is great',
218- // id is symfony.is.amazing
219- 'amazing' => 'Symfony is amazing',
220- ],
221- 'has' => [
222- // id is symfony.has.bundles
223- 'bundles' => 'Symfony has bundles',
224- ],
214+ [
215+ 'symfony' => [
216+ 'is' => [
217+ // id is symfony.is.great
218+ 'great' => 'Symfony is great',
219+ // id is symfony.is.amazing
220+ 'amazing' => 'Symfony is amazing',
225221 ],
226- 'user ' => [
227- // id is user.login
228- 'login ' => 'Login ',
222+ 'has ' => [
223+ // id is symfony.has.bundles
224+ 'bundles ' => 'Symfony has bundles ',
229225 ],
230- ];
226+ ],
227+ 'user' => [
228+ // id is user.login
229+ 'login' => 'Login',
230+ ],
231+ ];
231232
232233 The Translation Process
233234~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments