Skip to content

Navigation Menu

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

[FrameworkBundle] Rename translation:update to translation:extract #43758

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, 2021

Conversation

welcoMattic
Copy link
Member

@welcoMattic welcoMattic commented Oct 26, 2021

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? yes
Tickets Fix #41411
License MIT
Doc PR

As we discussed in #41411, I've renamed translation:update to translation:extract which is a more accurate name.

translation:update will trigger a deprecation alert until 6.0 where we could remove it completely. For now all the code of the command lives in TranslationExtractCommand.php file, and TranslationUpdateCommand call it.

I think it should be merged after #43676.

It's my first attempt to deprecate something in Symfony, let me know if I forgot something or if I did something wrong.

@nicolas-grekas
Copy link
Member

While at it, let's move the command to the component instead of fwb, wdyt?

@stof
Copy link
Member

stof commented Oct 26, 2021

When renaming a command, we need to have the old name as an alias of the new name in the command. Otherwise, it is a BC break for people calling the command in the CLI.

@nicolas-grekas the command currently relies on getting the Kernel from the Application, which relies on the FrameworkBundle Application, so it does not make sense to move it.

@nicolas-grekas
Copy link
Member

But the kernel can be injected to the constructor instead of relying on getApplication, isn't it?

@welcoMattic
Copy link
Member Author

welcoMattic commented Oct 26, 2021

@stof by alias do you mean something like that in console.php ?

->alias('console.command.translation_update', 'console.command.translation_extract')

@nicolas-grekas I'm not comfortable to move the command in the component right now (at least in this PR). Moreover it relies to the Kernel as @stof said, so I'm not sure we can move it.

@nicolas-grekas
Copy link
Member

Moving means deprecating, we'd better not deprecate twice the same command, that's why I'm wondering.

@stof
Copy link
Member

stof commented Oct 26, 2021

@welcoMattic no, I'm not talking about aliasing the service. I'm talking about defining aliases for the command name in the Command itself

@stof
Copy link
Member

stof commented Oct 26, 2021

Note that there is really 2 separate renamings here:

  • renaming the PHP class
  • renaming the CLI command

If we are not sure the new location of the class, we might delay that class renaming until Symfony 6.1, doing only the command renaming before the feature freeze.

@welcoMattic
Copy link
Member Author

@stof Ok, I got it. But renaming the CLI command without renaming the file is kind of half done job. I'll try to move it to the Component, I'm just not sure about how to inject the Kernel (like any other service?).

@chalasr
Copy link
Member

chalasr commented Oct 26, 2021

we'd better not deprecate twice the same command

Moving does not necessarily imply deprecating in this case since the command uses the kernel mainly for extracting translations from a given bundle. So the command could be split in one base command located in the component and one bundle-aware decorator in framework-bundle, as we did for yaml and twig lint commands.
Also this move could apply to other translation commands, I vote for postponing it.

@stof
Copy link
Member

stof commented Oct 26, 2021

@welcoMattic I would still say more than half, as it is the part of the renaming that solves the DX issue (devs using FrameworkBundle don't care about the class names of commands, as FrameworkBundle is registering them)

@welcoMattic
Copy link
Member Author

I've just push the renaming of the CLI command only, with the deprecation trigger in case of usage of translation:update.
Are we ok to postpone the renaming/moving of the file to 6.1?

@welcoMattic welcoMattic force-pushed the rename-trans-update branch 2 times, most recently from c1219bb to ad3faf8 Compare October 26, 2021 17:31
@chalasr
Copy link
Member

chalasr commented Oct 27, 2021

When deprecating something, we try to keep at least one test covering the legacy behavior. Can you please do that?
Rebase needed also

@welcoMattic
Copy link
Member Author

@chalasr thanks for the advice, it's done here, rebase too.

@fabpot
Copy link
Member

fabpot commented Oct 28, 2021

Thank you @welcoMattic.

@fabpot fabpot merged commit 9f4fc3f into symfony:5.4 Oct 28, 2021
@welcoMattic welcoMattic deleted the rename-trans-update branch October 28, 2021 08:02
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Oct 28, 2021
…anslation:extract (welcoMattic)

This PR was merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] Rename translation:update to translation:extract

Ref symfony#16023
The code has been merged in symfony/symfony#43758

I'm not 100% sure about the position of the deprecated block, let me know if I have to move it elsewhere.

Commits
-------

7f44b33 Rename translation:update to translation:extract
fabpot added a commit that referenced this pull request Oct 30, 2021
… of using trigger_deprecation call (welcoMattic)

This PR was squashed before being merged into the 5.3 branch.

Discussion
----------

[FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| License       | MIT
| Doc PR        |

As discussed in #43758 (comment), I change the way to deprecate options by using warning on stderr instead of `trigger_deprecation` call.

Commits
-------

663eb29 [FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call
symfony-splitter pushed a commit to symfony/messenger that referenced this pull request Oct 30, 2021
… of using trigger_deprecation call (welcoMattic)

This PR was squashed before being merged into the 5.3 branch.

Discussion
----------

[FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| License       | MIT
| Doc PR        |

As discussed in symfony/symfony#43758 (comment), I change the way to deprecate options by using warning on stderr instead of `trigger_deprecation` call.

Commits
-------

663eb29245 [FrameworkBundle] Trigger deprecations on stderr instead of using trigger_deprecation call
This was referenced Nov 5, 2021
fabpot added a commit that referenced this pull request Dec 7, 2024
…nslationExtract command to match the command name (welcoMattic)

This PR was merged into the 7.3 branch.

Discussion
----------

[FrameworkBundle] Rename TranslationUpdateCommand to TranslationExtract command to match the command name

| Q             | A
| ------------- | ---
| Branch?       | 7.3 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT

In #43758, `translation:update` command has been renamed to `translation:extract` command. But the file has never been renamed. This PR deprecate the `TranslationUpdateCommand` class in favor to `TranslationExtractCommand`. So, in 8.0 we could remove `TranslationUpdateCommand` file completely.

Commits
-------

a61bd89 Rename TranslationUpdateCommand to TranslationExtract command to match the command name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Translation] Rename translation:update command
6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.