Skip to content

Commit

Permalink
minor symfony#10091 Image to console (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.8 branch (closes symfony#10091).

Discussion
----------

Image to console

Some of our images are screenshots of the console output ... let's turn them into real console outputs (except when formatting and colors are important ... e.g. in some advanced console screenshots).

Commits
-------

881bd15 Image to console
  • Loading branch information
javiereguiluz committed Jul 19, 2018
2 parents a29603d + 881bd15 commit c195250
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 11 deletions.
Binary file removed _images/components/console/table.png
Binary file not shown.
Binary file removed _images/components/phpunit_bridge/report.png
Binary file not shown.
Binary file removed _images/translation/debug_1.png
Binary file not shown.
Binary file removed _images/translation/debug_2.png
Binary file not shown.
Binary file removed _images/translation/debug_3.png
Binary file not shown.
Binary file removed _images/translation/debug_4.png
Binary file not shown.
11 changes: 10 additions & 1 deletion components/console/helpers/tablehelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ Table Helper

When building a console application it may be useful to display tabular data:

.. image:: /_images/components/console/table.png
.. code-block:: terminal
+---------------+--------------------------+------------------+
| ISBN | Title | Author |
+---------------+--------------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
+---------------+--------------------------+------------------+
To display a table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
set headers, rows and render::
Expand Down
18 changes: 17 additions & 1 deletion components/phpunit_bridge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,23 @@ to provide more features:
After running your PHPUnit tests, you will get a report similar to this one:

.. image:: /_images/components/phpunit_bridge/report.png
.. code-block:: terminal
$ phpunit -c app
PHPUnit by Sebastian Bergmann.
Configuration read from <your-project>/app/phpunit.xml.dist
.................
Time: 1.77 seconds, Memory: 5.75Mb
OK (17 tests, 21 assertions)
Remaining deprecation notices (2)
getEntityManager is deprecated since Symfony 2.1. Use getManager instead: 2x
1x in DefaultControllerTest::testPublicUrls from AppBundle\Tests\Controller
1x in BlogControllerTest::testIndex from AppBundle\Tests\Controller
The summary includes:

Expand Down
60 changes: 51 additions & 9 deletions translation/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,16 @@ To inspect all messages in the ``fr`` locale for the AcmeDemoBundle, run:
$ php app/console debug:translation fr AcmeDemoBundle
You will get this output:
+----------+-------------------+----------------------+-------------------------------+
| State(s) | Id | Message Preview (fr) | Fallback Message Preview (en) |
+----------+-------------------+----------------------+-------------------------------+
| o | Symfony2 is great | J'aime Symfony2 | Symfony2 is great |
+----------+-------------------+----------------------+-------------------------------+
.. image:: /_images/translation/debug_1.png
:align: center
Legend:
x Missing message
o Unused message
= Same as the fallback message
It shows you a table with the result when translating the message in the ``fr``
locale and the result when the fallback locale ``en`` would be used. On top
Expand All @@ -128,17 +134,41 @@ because it is translated, but you haven't used it anywhere yet.
Now, if you translate the message in one of your templates, you will get this
output:

.. image:: /_images/translation/debug_2.png
:align: center
.. code-block:: terminal
$ php app/console debug:translation fr AcmeDemoBundle
+----------+-------------------+----------------------+-------------------------------+
| State(s) | Id | Message Preview (fr) | Fallback Message Preview (en) |
+----------+-------------------+----------------------+-------------------------------+
| | Symfony2 is great | J'aime Symfony2 | Symfony2 is great |
+----------+-------------------+----------------------+-------------------------------+
Legend:
x Missing message
o Unused message
= Same as the fallback message
The state is empty which means the message is translated in the ``fr`` locale
and used in one or more templates.

If you delete the message ``Symfony is great`` from your translation file
for the ``fr`` locale and run the command, you will get:

.. image:: /_images/translation/debug_3.png
:align: center
.. code-block:: terminal
$ php app/console debug:translation fr AcmeDemoBundle
+----------+-------------------+----------------------+-------------------------------+
| State(s) | Id | Message Preview (fr) | Fallback Message Preview (en) |
+----------+-------------------+----------------------+-------------------------------+
| x = | Symfony2 is great | J'aime Symfony2 | Symfony2 is great |
+----------+-------------------+----------------------+-------------------------------+
Legend:
x Missing message
o Unused message
= Same as the fallback message
The state indicates the message is missing because it is not translated in
the ``fr`` locale but it is still used in the template. Moreover, the message
Expand All @@ -149,8 +179,20 @@ the ``en`` locale.
If you copy the content of the translation file in the ``en`` locale, to the
translation file in the ``fr`` locale and run the command, you will get:

.. image:: /_images/translation/debug_4.png
:align: center
.. code-block:: terminal
$ php app/console debug:translation fr AcmeDemoBundle
+----------+-------------------+----------------------+-------------------------------+
| State(s) | Id | Message Preview (fr) | Fallback Message Preview (en) |
+----------+-------------------+----------------------+-------------------------------+
| = | Symfony2 is great | J'aime Symfony2 | Symfony2 is great |
+----------+-------------------+----------------------+-------------------------------+
Legend:
x Missing message
o Unused message
= Same as the fallback message
You can see that the translations of the message are identical in the ``fr``
and ``en`` locales which means this message was probably copied from French
Expand Down

0 comments on commit c195250

Please sign in to comment.