perl-unicode

Re: Interesting idea for string resources

2001-09-27 18:45:01
Hello Brian,

At 09:26 01/09/27 -0700, Brian Stell wrote:
James Briggs wrote:
> ...
> Basically, invent a new quote operator (qL) and have it
> call a user function to do resource lookup with dbm or
> DBI or whatever.
>
> It would look like:
>
> print qL(The weather is $skycover today.);

This method is useful in 2 areas:

 1) a bridge to allow pre-existing apps to be converted rapidly

 2) resource strings for simple / small apps

For larger apps the issue is that using the text as the key
is not quite unique enough. Sometimes the same text in English
needs different translations in other languages depending on
the subtleties.

Yes, in principle. But:

- It should be possible to use context information to distinguish
  the two strings. This idea is due to Philip Greenspun, of photo.net
  fame, who proposed to use the uri as an additional lookup parameter
  in a cgi script. This would need changes to the implementation of
  qL, and the initialization, but would leave the actual call untouched
  (and thus readable).

- It is possible to introduce a convention
  (e.g. print qL(##53##The weather is $skycover today.);)
  where ##53## serves as a message number. This is completely
  independent of implementation.


I have seen companies start out with this method but in
the long run they all moved away from it.

What do they move to?

Anyway, with something like ##53##, they can start out, and
move away, but still stay with it :-).

Of course, nobody is required to use it. In perl, there is always
more than one way :-).

Anyway, I mostly want to know how I could go about to make this
possible, not whether it's a good idea or not (which everybody
can decide on their own). In may view, the main implementation
problems are:

- How to get 'qL' (or whatever we choose) to start a quotation
  and call something.
- In the called place, how to make sure that variable substitution
  occurs using the variables defined where the qL was.

Any help or advice is highly appreciated.


Regards,   Martin.

<Prev in Thread] Current Thread [Next in Thread>