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:

  1. LOCALE_PATH=debian/tmpdir/usr/lib/locale
  2. LOCALE_NAME=en_IN
  3. LOCALE_CHARSET=UTF-8
  4. mkdir -p $LOCALE_PATH
  5. localedef -i $LOCALE_NAME.$LOCALE_CHARSET -f $LOCALE_CHARSET $LOCALE_PATH/$LOCALE_NAME.$LOCALE_CHARSET
  6. # Using the locale
  7. LOCPATH=$LOCALE_PATH LC_ALL=$LOCALE_NAME.$LOCALE_CHARSET date