CodeIgniter Forums
How can I use parameters with language files? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How can I use parameters with language files? (/showthread.php?tid=53057)



How can I use parameters with language files? - El Forum - 07-09-2012

[eluser]Alhazred[/eluser]
In my language file I need a sentence with a parameter in it.

In the CI native language files I've seen that some of them have a %s which works as parameter.
How can I use the same in my language files? How do I pass the words which will replace the %s?


How can I use parameters with language files? - El Forum - 07-09-2012

[eluser]Alhazred[/eluser]
oh, I think it is easier than I thought.
I suppose it is enough to use printf() when I have to to show the message.


How can I use parameters with language files? - El Forum - 07-09-2012

[eluser]PhilTem[/eluser]
It is indeed the printf-function that is used for these cases. You just cannot echo in this case but have to use a printf of the language-line Wink