On 05/07/2016 04:13 PM, James Le Cuirot wrote:
>
> + if [[ $(tr -s "[:space:]" "\n" <<< "${PLOCALES}" | sort | xargs echo)
> != ${current%[[:space:]]} ]] ; then
The stuff on the left-hand side just sorts a space-separated list,
right? It might be time to split that into another function. It looks a
lot less insane when it's,
if [[ $(l10n_sort_spaces "${PLOCALES}") != ${current%[[:space:]]} ]]
Then the function would just be
# @FUNCTION: l10n_sort_spaces
# @DESCRIPTION:
# Takes a space-separated list of strings as an argument and sorts
# them. The output is again space-separated. This is accomplished
# by first replacing the spaces with newlines so that "sort" can
# be used, and then collecting the output back onto one line.
function l10n_sort_spaces() {
tr -s "[:space:]" "\n" <<< "${1}" | sort | xargs echo
}
You should also document why you're doing that nearby, since like you
said, the eclass assumes that PLOCALES is sorted. Someone will wonder
why you're doing it again.