Skip to content

[Translation] Documented the debug:translation exit codes #13383

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

Merged
merged 1 commit into from
Mar 27, 2020
Merged
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
30 changes: 30 additions & 0 deletions translation/debug.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,33 @@ unused or only the missing messages, by using the ``--only-unused`` or

$ php bin/console debug:translation en --only-unused
$ php bin/console debug:translation en --only-missing

Debug Command Exit Codes
------------------------

The exit code of the ``debug:translation`` command changes depending on the
status of the translations. Use the following public constants to check it::

use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;

// generic failure (e.g. there are no translations)
TranslationDebugCommand::EXIT_CODE_GENERAL_ERROR;

// there are missing translations
TranslationDebugCommand::EXIT_CODE_MISSING;

// there are unused translations
TranslationDebugCommand::EXIT_CODE_UNUSED;

// some translations are using the fallback translation
TranslationDebugCommand::EXIT_CODE_FALLBACK;

These constants are defined as "bit masks", so you can combine them as follows::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz Are you sure about this? Looking at the code this doesn't seem to be the case to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. Let's ask to @DAcodedBEAT, the original author of this feature. Thanks!


if (TranslationDebugCommand::EXIT_CODE_MISSING | TranslationDebugCommand::EXIT_CODE_UNUSED) {
// ... there are missing and/or unused translations
}

.. versionadded:: 5.1

The exit codes were introduced in Symfony 5.1