Skip to content
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

Make sort sensitivity opt-in and configurable #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bjarne-callewaert
Copy link

In a recent PR (#35), the sorting of strings was adjusted to be case-insensitive. This is not an option for us, so I made the functionality optional with the parameter --sort-sensitivity. If not provided, the old behavior is re-applied.

The unit tests for the postprocessor so they have been updated and expanded

Copy link
Member

@michaelbromley michaelbromley left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution!

I made a couple of comments.

@@ -63,5 +162,24 @@ describe('SortByKeyPostProcessor', () => {
i: { value: 'letter i', sourceFiles: [] },
j: { value: 'letter j', sourceFiles: [] }
});

expect(Object.keys(processor.process(collection, new TranslationCollection(), new TranslationCollection()).values)).to.deep.equal(
Object.keys({
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what this assertion is testing beyond what the test above it is testing? Can you clarify this?

@@ -110,6 +110,7 @@ Output
--format, -f Format [string] [choices: "json", "namespaced-json", "pot"] [default: "json"]
--format-indentation, --fi Format indentation (JSON/Namedspaced JSON) [string] [default: "\t"]
--sort, -s Sort strings in alphabetical order [boolean]
--sort-sensitivity, -ss Sensitivity when sorting strings [string]
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to add a dedicated section to the readme about sorting now. If I understand correctly, the -ss flag only has an effect in combination with the -s flag right? That should be noted.

Also this section can explain how strings will be sorted without the -ss flag, as well as what the different options are and what effect they have on the sort order.

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.

None yet

2 participants