replacing ${LANG:0:2}technosaurus wrote:i had done it like this:
[ -e /etc/locale/${LANG}/init ] && . /etc/locale/${LANG}/init
but realized that sometimes it may be something like de_DE (thus the case statement)
but now that you mentioned it, it could beCode: Select all
[ -e /etc/locale/${LANG:0:2}/init ] && . /etc/locale/${LANG:0:2}/init
by
`echo $LANG | cut -d '_' -f 1` (or equivalent in pure shell)
would serve 3-letters coded languages too, they exist