-
Notifications
You must be signed in to change notification settings - Fork 293
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
Allow keys to be sorted alphabetically instead of binarily #702
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
I'm also having the issue, that the alphabetical sorted JSONs exported from lokalise.com have different sorting than the ones re-ordered by the code-extension when adding a key via the built-in dialog. |
I have the same problem; this causes inconsistency between editing from the i18n-ally editor with |
* add option to sorting message by a locale's order Fixes #702 * Empty commit to trigger CI --------- Co-authored-by: Alex Terehov <terales@users.noreply.github.com>
) * add option to sorting message by a locale's order Fixes lokalise#702 * Empty commit to trigger CI --------- Co-authored-by: Alex Terehov <terales@users.noreply.github.com>
Additional context
i18n Ally seems to use a binary sort. Given the following this is how i18n Ally will sort messages vs. what is expected and how other tooling may sort the messages.
Normally you'd expect "O" to come after "i" (either because "o" comes after "i" or because "O" is capitalized). However when i18n Ally sorts the "O" comes before "i". This appears to be because i18n Ally uses the default
.sort()
which does a binary sort of strings. And'O'.charCodeAt(0) === 79
while'i'.charCodeAt(0) === 105
.Is your feature related to a specific framework or general for this extension
General
Is your feature request related to a problem? Please describe.
I want to use i18next-parser to cleanup my messages files. However when I tell i18n Ally to sort it sorts the already sorted messages differently because i18next-parser (and potentially other tools) uses an alphabetic sort instead of a binary sort.
Describe the solution you'd like
i18n Ally should have a way to sort keys using an Intl.Collator instead of a binary sort.
I think we should add a
sortLocale
setting with the following possible options:binary
(default, current behaviour) do a binary sortauto
- use the message's own locale as the sort collator (i.e. sorten/common.json
using anen
collator and sortfr/common.json
with afr
collator)locale code
- sort using this locale's collator (i.e. ifen
sort all messages files with anen
collator)The text was updated successfully, but these errors were encountered: