Sort and format file with Spanish translations.
[why]
Sorting the keys gives the advantage of having strings with same context
together making it easier to have consistency on translations.
[how]
1. Having a .edn file execute:
grep ":" src/resources/dicts/es.edn | grep -v "/" | sort > single_keys
grep ":" src/resources/dicts/es.edn | grep "/" | sort > hierarchical_keys
2. Both files are sorted, now manually merge them into sorted_file. I
decided to left turial keys on top, then single_keys and finally
hierarchical_keys at the end. Check the braces.
3. Execute this script:
#!/bin/bash
while IFS= read -r line; do
if [[ "$line" == *\"* ]]; then
first_quote_index=$(expr index "$line" \")
content_after_quote="${line:$first_quote_index}"
content_before_quote="${line:0:$first_quote_index-1}"
spaces=$(printf '%*s' $((52 - ${#content_before_quote})))
echo "$content_before_quote$spaces\"$content_after_quote"
else
echo "$line"
fi
done <sorted_file >formatted_file
4. Replace the .edn file with the resultant formated_file. Now all
strings start at column 53.