Internationalizing strings with variables

Yesterday i wrote that you can use __($string, $domain) and _e($string, $domain) to internationalize a string with WordPress. I forgot to mention that if you use sprintf you can handle strings with variables too. An example:

echo sprintf(__('There are %d monkeys in the %s'), $domain), $number, $location);

This entry was posted on Sunday, March 19th, 2006 at 02:47 and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.