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

[Translation] added logging capability. #4050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added logging to translator.
  • Loading branch information
aitboudad committed Oct 27, 2014
commit 0c048dda247e24b47d5bac363e1f99bfa6500d45
9 changes: 9 additions & 0 deletions 9 book/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,15 @@ checks translation resources for several different locales:
3. If the translation still isn't found, Symfony uses the ``fallback`` configuration
parameter, which defaults to ``en`` (see `Configuration`_).

.. versionadded:: 2.6
The ability to log missing translations was introduced in Symfony 2.6.

.. note::

When Symfony doesn't find a translation in the given locale, it will
add the missing translation to the log file. For details,
see :ref:`reference-framework-translator-logging`.

.. _book-translation-user-locale:

Handling the User's Locale
Expand Down
41 changes: 41 additions & 0 deletions 41 reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ Configuration
* `profiler`_
* `collect`_
* :ref:`enabled <profiler.enabled>`
* `translator`_
* :ref:`enabled <translator.enabled>`
* `fallback`_
* `logging`_

secret
~~~~~~
Expand Down Expand Up @@ -495,6 +499,42 @@ and activate the data collectors by hand::

$profiler->enable();

translator
~~~~~~~~~~

.. _translator.enabled:

enabled
.......

**type**: ``boolean`` **default**: ``false``

Whether or not to enable the ``translator`` service in the service container.

fallback
........

**default**: ``en``

This option is used when the translation key for the current locale wasn't found.

For more details, see :doc:`/book/translation`.

.. _reference-framework-translator-logging:

logging
.......

.. versionadded:: 2.6
The ``logging`` option was introduced in Symfony 2.6.

**default**: ``true`` when the debug mode is enabled, ``false`` otherwise.

When ``true``, a log entry is made whenever the translator cannot find a translation
for a given key. The logs are made to the ``translation`` channel and at the ``debug``
for level for keys where there is a translation in the fallback locale and the ``warning``
level if there is no translation to use at all.

Full default Configuration
--------------------------

Expand Down Expand Up @@ -612,6 +652,7 @@ Full default Configuration
translator:
enabled: false
fallback: en
logging: "%kernel.debug%"

# validation configuration
validation:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.