[bcc][faked-from] Re: [development] check_markup() question
Allie Micka
allie at pajunas.com
Thu Apr 13 15:57:25 UTC 2006
On Apr 13, 2006, at 9:56 AM, Mark Fredrickson wrote:
>
> A script should have information about both the person doing the
> calling and the target individual. (eg. "Hello, my name is {John
> Smith}, may I speak with {Janet Jones}? Hello {Ms. Jones}, I'd like
> to talk to you about your key issue, {the environment}..." -- where
> {} denotes a field from either the caller's or the target's
> CiviCRM record). I've been storing the script in the node, but the
> caller and target won't be known until later (when a user
> participates in the phone bank).
Ok, that I understand. This is being done in a number of places with
Drupal (e.g. registration mails). And the code for it would be:
$script = strtr($string, $variables);
Or, if you want it to be translatable:
$script = t($string, $variables);
Where:
$string = "Hello, my name is %caller_name, may I speak with %
recipient_name?..."
$variables = array('%caller_name' => 'John Smith', '%
recipient_name' => 'Janet Jones');
As you can see, the translation code itself is so succinct that it
would be silly to write frameworks around it and it need not have
anything to do with filters. The real heavy lifting is populating
that $string and those $variables. I don't know how you'd generalize
this - it's pretty application-specific.
Allie Micka
pajunas interactive, inc.
http://www.pajunas.com
scalable web hosting and open source strategies
More information about the development
mailing list