Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[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

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedOct 22, 2021
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
TicketsPart of#43594
LicenseMIT
Doc PRNA

@carsonbotcarsonbot added this to the5.4 milestoneOct 22, 2021
@alexandre-dauboisalexandre-dauboisforce-pushed thefeat/debug-translation-autocomplete branch 3 times, most recently from2d1f985 tob0a55a4CompareOctober 22, 2021 07:01
@GromNaN
Copy link
Member

Completion don't have to be exhaustive. Bundle names can be completed getting the name of each bundle provided by$kernel->getBundles(). That would be useful.

wouterj and alexandre-daubois reacted with thumbs up emoji

publicfunctioncomplete(CompletionInput$input,CompletionSuggestions$suggestions):void
{
if ($input->mustSuggestArgumentValuesFor('locale')) {
$suggestions->suggestValues(Locales::getLocales());
Copy link
Member

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.

alexandre-daubois and stephenkhoo reacted with eyes emoji
Copy link
MemberAuthor

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!

Copy link
Contributor

@stephenkhoostephenkhooOct 23, 2021
edited
Loading

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 Locales
ChainExtractor 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Translation/Loader/LoaderInterface.php

Also might need to consider third party translation loader included as the autocomplete suggestions.

Copy link
Member

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.

stephenkhoo and alexandre-daubois reacted with hooray emoji
Copy link
MemberAuthor

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.

stephenkhoo reacted with thumbs up emoji
Copy link
Member

@fabpotfabpotOct 25, 2021
edited
Loading

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.

wouterj, welcoMattic, and stephenkhoo reacted with thumbs up emoji
Copy link
MemberAuthor

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!

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, thanks

@alexandre-dauboisalexandre-dauboisforce-pushed thefeat/debug-translation-autocomplete branch fromb0a55a4 toa1c32b4CompareOctober 22, 2021 07:28
@alexandre-daubois
Copy link
MemberAuthor

Completion don't have to be exhaustive. Bundle names can be completed getting the name of each bundle provided by$kernel->getBundles(). That would be useful.

Suits me fine. Added!

GromNaN reacted with thumbs up emoji

@alexandre-dauboisalexandre-dauboisforce-pushed thefeat/debug-translation-autocomplete branch froma1c32b4 to1388391CompareOctober 22, 2021 07:29
@carsonbotcarsonbot changed the title[Console] Add completion to debug:translation command[FrameworkBundle] Add completion to debug:translation commandOct 24, 2021
@alexandre-dauboisalexandre-dauboisforce-pushed thefeat/debug-translation-autocomplete branch 3 times, most recently from1529f97 to454d1b5CompareOctober 25, 2021 16:32
@alexandre-dauboisalexandre-dauboisforce-pushed thefeat/debug-translation-autocomplete branch from621d83c to086a8b4CompareOctober 26, 2021 14:21
fabpot added a commit that referenced this pull requestOct 29, 2021
…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
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestOct 29, 2021
…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
Copy link
Member

Thank you@alexandre-daubois.


yield'bundle' => [
['fr','--domain','messages',''],
['ExtensionWithoutConfigTestBundle','extension_without_config_test'],
Copy link
Member

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Taking a look ASAP 👍

This was referencedNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@GromNaNGromNaNGromNaN left review comments

@stofstofstof left review comments

@wouterjwouterjwouterj left review comments

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@stephenkhoostephenkhoostephenkhoo left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

8 participants

@alexandre-daubois@GromNaN@fabpot@stof@wouterj@stephenkhoo@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp