6.7.6. Needing a certain locale during build
If you need a certain locale during build, you can create a temporary file via this trick:
If you set LOCPATH
to the equivalent of /usr/lib/locale
, and LC_ALL
to the name of the locale you generate, you should get what you want without being root. Something like this:
LOCALE_PATH=debian/tmpdir/usr/lib/locale
LOCALE_NAME=en_IN
LOCALE_CHARSET=UTF-8
mkdir -p $LOCALE_PATH
localedef -i $LOCALE_NAME.$LOCALE_CHARSET -f $LOCALE_CHARSET $LOCALE_PATH/$LOCALE_NAME.$LOCALE_CHARSET
# Using the locale
LOCPATH=$LOCALE_PATH LC_ALL=$LOCALE_NAME.$LOCALE_CHARSET date