Skip to content

feat: provide --flatten option for hoisting selectors#22

Merged
ramsey merged 2 commits intomainfrom
feature/hoist-selectors
Dec 13, 2021
Merged

feat: provide --flatten option for hoisting selectors#22
ramsey merged 2 commits intomainfrom
feature/hoist-selectors

Conversation

@ramsey
Copy link
Copy Markdown
Contributor

@ramsey ramsey commented Dec 13, 2021

Description

This PR provides a --flatten extraction option to tell the extractor to hoist selectors and flatten sentences as much as possible. For example,

I have {count, plural, one{a dog} other{many dogs}}

becomes

{count, plural, one{I have a dog} other{I have many dogs}}

The goal is to provide as many full sentences as possible, since fragmented sentences are not translator-friendly.

Product requirements and context

How has this been tested?

PR Checklist

  • I have added tests to cover my changes.

@ramsey ramsey requested a review from a team December 13, 2021 04:23
Comment thread src/Icu/MessageFormat/Printer.php
Comment thread src/Icu/MessageFormat/Printer.php
Comment thread src/Icu/MessageFormat/Printer.php
Comment thread src/Icu/MessageFormat/Printer.php
Comment thread src/Icu/MessageFormat/Printer.php
* The goal is to provide as many full sentences as possible since
* fragmented sentences are not translator-friendly.
*/
public function hoistSelectors(ElementCollection $ast): ElementCollection
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function hoistSelectors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.

@qlty-cloud-legacy
Copy link
Copy Markdown

Code Climate has analyzed commit 1b36e96 and detected 6 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 6

The test coverage on the diff in this pull request is 100.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 96.3% (0.2% change).

View more on Code Climate.

@ramsey ramsey merged commit ccee19b into main Dec 13, 2021
@ramsey ramsey deleted the feature/hoist-selectors branch December 13, 2021 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants