-
Notifications
You must be signed in to change notification settings - Fork 722
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
Strings: unstable output for keys that differ just by case #891
Comments
I honestly had to dig for quite a bit (because of the repo split -> back to one repo), until I found the change that added this: From the discussion in that PR, I can't seem to find any mention WHY we did it, nor are there any issues around that time related to this. It was probably done because it's "nicer" to have things alphabetically. Sorting case-insensitively is usually better/more readable 🤷 |
Note that at in that same PR eventually switched to During the repo split, that got reverted to comparison using |
If .strings contains two keys that differ just by case, the order of entries in the generated .swift file is not stable from invocation to invocation.
This is quite edge case, given that (as far as I understand) SwiftGen does not support multiple entries that differ just by case, but it still happens in our case, as we have to entries that differ just by case of keys and number of parameters, like below.
Localizable.strings:
The other rationale for this change is that the current case-insensitive sorting does not make that much sense in case camelCase is used for the keys: capital letters in camelCase typically introduce a grouping/another "word", but lowercase letters just introduce word variation. From that perspective I believe that word variations should better belong to one group.
Demo of the issue: https://github.com/grigorye/SwiftGen-Case-Insensitive
The text was updated successfully, but these errors were encountered: