Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] Add completion to debug:translation command#43644
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[FrameworkBundle] Add completion to debug:translation command#43644
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2d1f985 tob0a55a4CompareGromNaN commentedOct 22, 2021
Completion don't have to be exhaustive. Bundle names can be completed getting the name of each bundle provided by |
| publicfunctioncomplete(CompletionInput$input,CompletionSuggestions$suggestions):void | ||
| { | ||
| if ($input->mustSuggestArgumentValuesFor('locale')) { | ||
| $suggestions->suggestValues(Locales::getLocales()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is a very long list. Since this command describes the state of the application, I think it would be more useful if only the used locales were listed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No problem, taking a look at it!
stephenkhooOct 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm working on another translation related command that require to autocomplete for locale too.
I'm thinking if we're going to have only used locales, maybe we will need to addgetUsedLocals() intoExtractorInterface andTranslationReaderInterface
So far I only know the we need to do as below if we're adding into the interface.TranslationReader need to put the logic for getting the LocalesChainExtractor andPhpExtractor also need to add the logic to get used Locales.
Quick global search within the repo also gave me one more class that needs update:Symfony\Bridge\Twig\Translation\TwigExtractor
But not quite sure if it will affect other third party package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Also might need to consider third party translation loader included as the autocomplete suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
FrameworkBundle has a concept of enabled locales. I suggest using those for the completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Does this really make sense to limit locales completion to the "enabled" ones in the project, aside that it seems tricky to get these enabled locales? Symfony already bundles a lot of messages in dozens of locales. Restricting completion could kind of prevent displaying messages defined by Symfony in domains like thevalidators one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Here, it's only about completion, I'm fine with auto-completing only the enabled locales. If you want another one, just type it explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Alright, I'm on it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@stephenkhoo to access the enabled locales, use DI, i.e. inject them in the command constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Got it, thanks
b0a55a4 toa1c32b4Comparealexandre-daubois commentedOct 22, 2021
Suits me fine. Added! |
a1c32b4 to1388391CompareUh oh!
There was an error while loading.Please reload this page.
1529f97 to454d1b5CompareUh oh!
There was an error while loading.Please reload this page.
454d1b5 to621d83cCompare621d83c to086a8b4Compare…n:update command (stephenkhoo)This PR was squashed before being merged into the 5.4 branch.Discussion----------[FrameworkBundle] Add completion feature on translation:update command| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | Part of#43594| License | MIT| Doc PR | -Adding completion for translation:update.- [x] locale- [X] bundle- [X] --format- [X] --domain- [X] --sortTest for- [x] locale- [x] bundle- [X] --format- [X] --domain- [X] --sortLocale completion still under discussion in#43644 (review)Locale and bundle test still not completeCommits-------2f301ae [FrameworkBundle] Add completion feature on translation:update command
…n:update command (stephenkhoo)This PR was squashed before being merged into the 5.4 branch.Discussion----------[FrameworkBundle] Add completion feature on translation:update command| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | Part of #43594| License | MIT| Doc PR | -Adding completion for translation:update.- [x] locale- [X] bundle- [X] --format- [X] --domain- [X] --sortTest for- [x] locale- [x] bundle- [X] --format- [X] --domain- [X] --sortLocale completion still under discussion insymfony/symfony#43644 (review)Locale and bundle test still not completeCommits-------2f301ae9e1 [FrameworkBundle] Add completion feature on translation:update command
fabpot commentedOct 29, 2021
Thank you@alexandre-daubois. |
| yield'bundle' => [ | ||
| ['fr','--domain','messages',''], | ||
| ['ExtensionWithoutConfigTestBundle','extension_without_config_test'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I get an exception when I use the bundle_name in snake case. Does it work for you? (It's ok with BundleName)
$bin/console debug:translation en framework "framework/translations" is neither an enabled bundle nor a directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Taking a look ASAP 👍
Uh oh!
There was an error while loading.Please reload this page.