From: Colin Watson Date: Thu, 16 Oct 2003 10:44:10 +0000 (+0000) Subject: locale-exists: New script to test whether a given locale exists on the X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=4bfde69a6dc7950a56b109e92e93b2f82447fc90 locale-exists: New script to test whether a given locale exists on the system. --- diff --git a/locale-exists b/locale-exists new file mode 100755 index 0000000..05c7e5b --- /dev/null +++ b/locale-exists @@ -0,0 +1,8 @@ +#! /bin/sh +set -e + +# Takes a locale as the first argument, or assumes $LANG if there are no +# arguments. Exits zero if the given locale exists, and non-zero otherwise. + +[ "$1" ] && export LANG="$1" +PERL_BADLANG=0 perl -MPOSIX -le 'exit 1 unless setlocale(LANG, "")'