Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e8e50fa

Browse filesBrowse files
aitboudadweaverryan
authored andcommitted
added logging to translator.
1 parent f587903 commit e8e50fa
Copy full SHA for e8e50fa

File tree

Expand file treeCollapse file tree

2 files changed

+50
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+50
-0
lines changed

‎book/translation.rst

Copy file name to clipboardExpand all lines: book/translation.rst
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,15 @@ checks translation resources for several different locales:
400400
3. If the translation still isn't found, Symfony uses the ``fallback`` configuration
401401
parameter, which defaults to ``en`` (see `Configuration`_).
402402

403+
.. versionadded:: 2.6
404+
The ability to log missing translations was introduced in Symfony 2.6.
405+
406+
.. note::
407+
408+
When Symfony doesn't find a translation in the given locale, it will
409+
add the missing translation to the log file. For details,
410+
see :ref:`reference-framework-translator-logging`.
411+
403412
.. _book-translation-user-locale:
404413

405414
Handling the User's Locale

‎reference/configuration/framework.rst

Copy file name to clipboardExpand all lines: reference/configuration/framework.rst
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Configuration
4848
* `profiler`_
4949
* `collect`_
5050
* :ref:`enabled <profiler.enabled>`
51+
* `translator`_
52+
* :ref:`enabled <translator.enabled>`
53+
* `fallback`_
54+
* `logging`_
5155

5256
secret
5357
~~~~~~
@@ -495,6 +499,42 @@ and activate the data collectors by hand::
495499

496500
$profiler->enable();
497501

502+
translator
503+
~~~~~~~~~~
504+
505+
.. _translator.enabled:
506+
507+
enabled
508+
.......
509+
510+
**type**: ``boolean`` **default**: ``false``
511+
512+
Whether or not to enable the ``translator`` service in the service container.
513+
514+
fallback
515+
........
516+
517+
**default**: ``en``
518+
519+
This option is used when the translation key for the current locale wasn't found.
520+
521+
For more details, see :doc:`/book/translation`.
522+
523+
.. _reference-framework-translator-logging:
524+
525+
logging
526+
.......
527+
528+
.. versionadded:: 2.6
529+
The ``logging`` option was introduced in Symfony 2.6.
530+
531+
**default**: ``true`` when the debug mode is enabled, ``false`` otherwise.
532+
533+
When ``true``, a log entry is made whenever the translator cannot find a translation
534+
for a given key. The logs are made to the ``translation`` channel and at the ``debug``
535+
for level for keys where there is a translation in the fallback locale and the ``warning``
536+
level if there is no translation to use at all.
537+
498538
Full default Configuration
499539
--------------------------
500540

@@ -612,6 +652,7 @@ Full default Configuration
612652
translator:
613653
enabled: false
614654
fallback: en
655+
logging: "%kernel.debug%"
615656
616657
# validation configuration
617658
validation:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.