freshOS / Localize

🏁 Automatically clean your Localizable.strings files
MIT License
354 stars 29 forks source link

[Feature] - Optional Alphabetic sort #2

Closed floriangbh closed 6 years ago

floriangbh commented 6 years ago

Allowing to configure the alphabetic sort

s4cha commented 6 years ago

Thinking about it now I remember that sorting the files alphabetically allowed for easier (and faster) warning generation. What I mean is that if an issue is found in the en file line 3, we can raise the warnings on the same line in other files, say es or fr.

Not sorting them automatically means keys could be ordered differently so we will need extra processing to find the right corresponding line in every file.

This shouldn't be too complex but it's something we need to keep in mind :)

s4cha commented 6 years ago

My bad after checking in the code, it's already relying on dictionaries rather that line numbers so it shouldn't be that big of a deal :)

s4cha commented 6 years ago
/*
 Sanitizing files will remove comments, empy lines and order your keys alphabetically.
 */
let sanitizeFiles = true

Set to false, it will prevent the script form modifying your files :)

floriangbh commented 6 years ago

This seems to work fine, thank you ;-)