-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add option --as-tree to translation:update command #38393
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
Conversation
@@ -84,6 +84,7 @@ protected function configure() | |||
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'), | |||
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'), | |||
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'), | |||
new InputOption('as-tree', null, InputOption::VALUE_NONE, 'Dump the messages as a tree-like structure'), |
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 would allow an argument which would be the "inline" option: --as-tree=3
.
@@ -13,6 +13,7 @@ CHANGELOG | |||
* added `framework.http_client.retry_failing` configuration tree | |||
* added `assertCheckboxChecked()` and `assertCheckboxNotChecked()` in `WebTestCase` | |||
* added `assertFormValue()` and `assertNoFormValue()` in `WebTestCase` | |||
* Added `--as-tree=3` option to `translation:update` command to dump messages as a tree-like structure. The given value defines the level where to switch to inline YAML |
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.
"--as-tree
"
@@ -84,6 +84,7 @@ protected function configure() | |||
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'), | |||
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'), | |||
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'), | |||
new InputOption('as-tree', null, InputOption::VALUE_OPTIONAL, 'Dump the messages as a tree-like structure: The given value defines the level where to switch to inline YAML'), |
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.
why not set the default value here?
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 wasn't sure about that at first, but decided to remove the default value because I can just call ...'as_tree' => $input->getOption('as-tree')...
when setting the writers options which will result in 'as_tree' => null
and with this make sure that the YamlFileDumper
wouldn't call the ArrayConverter::expandToTree($data);
method every time.
src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
Outdated
Show resolved
Hide resolved
Thank you @jschaedl. |
…ull` command (syffer) This PR was merged into the 6.4 branch. Discussion ---------- [Translation] Add `--as-tree` option to `translation:pull` command | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes/no | New feature? | yes | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | todo This PR adds an option `--as-tree` to the command `translation:pull`, like the PR #38393 did it for the command `translation:extract`. This option would ease the use of the command `translation:pull` when the yaml translations are stored as a tree. Without it, the yaml translations are inlined after a `translation:pull`, regardless of whether it was stored as inline or as a tree. To bypass this, you would either have to - re-indent the yaml file yourself after a `translation:pull` - replace one service (e.g. `translation.dumper.yaml`) to forcefully add the option `as_tree` for the yaml file dumper Commits ------- 2f328ad [Translation] Add `--as-tree` option to `translation:pull` command
Before:
After: