[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#383321: su-to-root => localisation ;-)



* Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> [2007-04-19 22:48] :
> On Sun, Aug 20, 2006 at 08:28:26AM -0500, Christian Perrier wrote:
> > >   GT5=$(gettext 'Incorrect password or command failed. Try again?')
> > >   echo -n "${GT5} (${ANS})"
> > >   read ans
> > >   if   [ ${FLAG} -eq 0 ] ; then
> > >     if test "${ans}" != "y" -a "${ans}" != "Y"; then exit 1 ; fi
> > >   elif [ ${FLAG} -eq 1 ] ; then
> > >     if test "${ans}" != "j" -a "${ans}" != "J"; then exit 1 ; fi
> > >   elif [ ${FLAG} -eq 2 ] ; then
> > >     if test "${ans}" != "o" -a "${ans}" != "N"; then exit 1 ; fi
> > >   fi
> > > }
> > 
> > I'm not sure how to do it in shell programming, but this anyway
> > doesn't scale very well to other languages. The locale information
> > should be used here (the Yes/No shortcuts are part of locale
> > files....I'm however not aware of the exact way to use them).
> 
> I have rewritten su-to-root to be more l10n-friendly by removing text
> duplication and using printf.
> 
> I need two advices from the l10n experts:
> 1) the best way to check if gettext is available.
> 2) the best way to deal with the yes/no prompting above.

You should use "locale yesexpr" and "locale noexpr" to know which
characters represent yes and no in the current language. The prompting
"(y/n)" should be translated as usual (by translators).

Greetings,


Fred



Reply to: