On Thu, Aug 5, 2010 at 11:13 PM, I. Szczesniak <[email protected]> wrote:
> On Thu, Aug 5, 2010 at 5:11 AM, David Korn <[email protected]> wrote:
>> cc:  [email protected]  [email protected]          
>> [email protected]  [email protected]          
>> [email protected]
>> Subject: Re: Re: Re: Re: Re: [ast-developers] Re: [ast-users] Write up on 
>> how to   localize shell scripts - Second Try
>> --------
>>
>>> Erm... can you make an example for this case, please ?
>>
>> A script can do
>>
>> commands1 ...
>> LC_ALL
>> commands2 ...
>>
>> and  command2 will use the new locale.
>>
>> However, since a function is a compound command, the locale will be
>> frozen the first time that the function is invoked and will not change.
>
> Why are the strings frozen at this point? Why can't the shell look the
> message up in the current catalog each time it is used? We could live
> with slow and unfrozen localised string literals but not with the
> inability to switch the message locale of already established
> functions. We require this to use the localised string literals in an
> installer which must be able to instantly switch between languages
> without having to restart the installer (this is a typical installer
> feature users expect these days).

I share your doubts. I expected that all shell functions could be used
to substitute real commands, but this would require that
function mycat
{
      print $"hello, this is a cat function"
}
LC_MESSAGES=C NLSPATH=/path/path2/myc1.cat:$NLSPATH mycat
LC_MESSAGES=C NLSPATH=/path/path2/myc2.cat:$NLSPATH mycat
LC_MESSAGES=fr_FR.UTF-8 NLSPATH=/path/path2/myc1.cat:$NLSPATH mycat
LC_MESSAGES=fr_FR.UTF-8 NLSPATH=/path/path2/myc2.cat:$NLSPATH mycat
could all print different messages, depending on the values of
LC_MESSAGES and NLSPATH.

If $"string" gets ever proposed as POSIX standard it must implement
this, to follow the spirit of the existing standard that functions can
substitute commands in all their functionality and to be a *true*
replacement for /bin/gettext. /bin/gettext is capable of switching
between catalogs and languages between each call and I'd expect
nothing of a replacement if it is proposed as part of the POSIX shell
spec.

Chris
-- 
    ^---^
   (@)v(@)  Chris Pickett
   |    /   IT consultant
 ===m==m=== [email protected]
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to