How can I insert variables into translated sentences?

I've got a multi-lang website and using the language class. But how do put variables in the translated sentences?

For example:
I want "You need 25 extra points.".

Is there something possible like ...
$lang['ui_messages'] = "You need $num extra points.";

$lang['ui_messages'] = "You need %s extra points.";

$points = 25;
$fmt = $this->lang->line('ui_messages');

$ui_messages = sprintf($fmt, $points);

Hi, I was asking myself the same question but regarding to anchors.

Before adding internationalization to my web I had the following string:

" called <strong>&lt;?php echo anchor('', 'CNN'); ?&gt;</strong>.  It's a..."

Now it won't work when included into:

$lang['home_dilemma_intro'] = " called <strong>&lt;?php echo anchor('', 'CNN'); ?&gt;</strong>.  It's a...";

How can I keep my anchors when translating the text?

Thanks in advanced,

Try this..
$lang['home_dilemma_intro'] = " called <strong>".anchor('', 'CNN')."</strong>.  It's a...";

That worked out.



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.