* David Green ([EMAIL PROTECTED]) [080131 08:48]:
> I've always wanted a magic-S (and I don't think the anglocentrism  
> matters, because Perl is already pretty anglocentric -- more so than  
> plural S's, which apply to some other languages anyway).

In "the good old days" all computer OSes were anglo-centric.  They are
not like that anymore.  But Perl still is.

>     use Locale::Lingua::EN;
>     say "There was\s {3} ox\s";    # There were 3 oxen
> 
>     use Locale::Lingua::Romana::Perligata;
>     say "{3} bos\s erat\s";        # 3 boves erant
> 
> Although calling it "\s" loses its impact in other languages....  But  
> I think the underlying idea to seize on is a way to grab interpolated  
> values so that there's a nice way to do tricks like that.  Preferably  
> in a way that doesn't look symmetrical so you can "point" it before or  
> behind.

As I suggested in a previous mail, we can do it by making say/print
a bit smarter.  Instead of interpolating before they are called,
we let them interpolate themselves, and optionally translate.

>     say "I've got $bid dollar\s, do I hear {$< + 1}?"

pre-parse standard call to (s)print(f)/say from

      say "I've got $bid dollar, do I hear ", $bid+1, "?"

into

      print "I've got \Ibid\E dollar, do I hear \I__ANON1__\E?\n",
          bid => $bid, __ANON1 => $bid+1, __LINE => __LINE__;

(introducting \I \E as interpolation indicators)
Isn't the (usual, existing) translation syntax a lot simpler than
you suggest?
(the rewrite will take place as first step within the print/say.
Translations must be implemented in the output layers, because only there
we know enough about character-set and end-user.  Within the program,
you do not want to be bothered with translated strings)

The default interpolation implementation for print() can be very simple.
However, now we can also make translation modules which use external
tables or databases to do the optional intelligent work.

I do not think that your
   use Locale::Lingua::Romana::Perligata;
is usable, because the translation (in general) adapts to the language
of the user of the module, not the likings of the author.  A more
general use is:
   setlocale('lat')

   open OUT, ">:language('lat'):encoding('latin1')", $f

-- 
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       [EMAIL PROTECTED]                          [EMAIL PROTECTED]
http://Mark.Overmeer.net                   http://solutions.overmeer.net

Reply via email to