On Tue, Aug 26, 2003 at 06:48:07PM -0400, Bob Hilliard wrote:
> Petter Reinholdtsen <[EMAIL PROTECTED]> writes:

> > 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 (mostly cut-n-paste from d-i
> > build system):

> >   # The variables
> >   LOCALE_PATH=/tmp/usr/lib/locale
> >   LOCALE_NAME=en_IN
> >   LOCALE_CHARSET=UTF-8

> >   # Generating the locale
> >   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

> Steve Langasek <[EMAIL PROTECTED]> added:

> > Looks like this needs to be localedef -i "$LOCALE_NAME" -f "$LOCALE_CHARSET"
> > instead, but otherwise, I've confirmed that this works.

>      I need to use this locale as a command line argument to dictfmt
> --locale.  dictfmt calls this locale with setlocale(3).  I have tried
> --locale $(LOCALE_NAME).$(LOCALE_CHARSET) and --locale
> $(LOCPATH)/$(LOCALE_NAME).$(LOCALE_CHARSET).  Both return invalid
> locale, which is the error message dictfmt emits when it cannot open
> the specified locale file.  The locale _is_ generated in
> $LOCALE_PATH.

>      Is the environment variable LOCPATH used by setlocale(3)?

>      Can anyone suggest what I need to try to make this work?

LOCPATH=/tmp/usr/lib/locale dictfmt --locale ($LOCALE_NAME).$(LOCALE_CHARSET)
ought to have the desired effect.  All locale-related glibc functions
should respect the value of LOCPATH.

-- 
Steve Langasek
postmodern programmer

Attachment: pgp7hEo6aPWUK.pgp
Description: PGP signature

Reply via email to