Skip to content

[Translation] Add --prefix and --no-fill to translation page #20352

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
Oct 28, 2024
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
25 changes: 25 additions & 0 deletions translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,33 @@ The ``translation:extract`` command looks for missing translations in:

$ composer require nikic/php-parser

By default, the ``translation:extract`` command extracts new messages in
*message/translation* pairs, with the translation populated with the same
text as the message, prefixed by ``__``. You can customize this prefix using
the ``--prefix`` option.

If you want to leave new translations empty, use the ``--no-fill`` option.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a versionadded directive for this new option ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I put directive after example.

When enabled, only messages are created, and the translation strings are left
empty. This is particularly useful when using external translation tools, as
it ensures untranslated strings are easily identifiable without any pre-filled
content. Note that when ``--no-fill`` is used, the ``--prefix`` option has
no effect.

.. code-block:: terminal

# changes default prefix
$ php bin/console translation:extract --force --prefix="NEW_" fr

# leaves new translations empty
$ php bin/console translation:extract --force --no-fill fr

.. versionadded:: 7.2

The ``--no-fill`` option was introduced in Symfony 7.2.

.. _translation-resource-locations:


Translation Resource/File Names and Locations
---------------------------------------------

Expand Down
Loading