How can I insert variables into translated sentences? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How can I insert variables into translated sentences? (/showthread.php?tid=42992) |
How can I insert variables into translated sentences? - El Forum - 06-26-2011 [eluser]suntrop[/eluser] 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."; How can I insert variables into translated sentences? - El Forum - 06-26-2011 [eluser]tomcode[/eluser] Code: $lang['ui_messages'] = "You need %s extra points."; How can I insert variables into translated sentences? - El Forum - 02-24-2012 [eluser]JuanG[/eluser] Hi, I was asking myself the same question but regarding to anchors. Before adding internationalization to my web I had the following string: Code: "...is called <strong><?php echo anchor('www.cnn.com', 'CNN'); ?></strong>. It's a..." Now it won't work when included into: Code: $lang['home_dilemma_intro'] = "...is called <strong><?php echo anchor('www.cnn.com', 'CNN'); ?></strong>. It's a..."; How can I keep my anchors when translating the text? Thanks in advanced, How can I insert variables into translated sentences? - El Forum - 03-08-2012 [eluser]Kristories[/eluser] Try this.. Code: $lang['home_dilemma_intro'] = "...is called <strong>".anchor('www.cnn.com', 'CNN')."</strong>. It's a..."; How can I insert variables into translated sentences? - El Forum - 03-09-2012 [eluser]JuanG[/eluser] That worked out. Thanks! How can I insert variables into translated sentences? - El Forum - 03-09-2012 [eluser]Kristories[/eluser] |