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
base: master
Are you sure you want to change the base?
Make sort sensitivity opt-in and configurable #41
Conversation
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.
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({ |
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 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] |
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 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.
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