CodeIgniter Forums
Using language in a helper - 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: Using language in a helper (/showthread.php?tid=8459)



Using language in a helper - El Forum - 05-19-2008

[eluser]MikeeJay[/eluser]
Hello,

How can I use the language files i a HELPER?

Normally I user $this->lang->line('blabla'), but since helpers are not classes I can't use that. Is there any native CI methods to do this, or should I simply check what language is used and include the lang files manually?


Using language in a helper - El Forum - 05-19-2008

[eluser]MikeeJay[/eluser]
Ahh, found it.
Code:
$CI = & get_instance();
$CI->lang->line('blabla');



Using language in a helper - El Forum - 05-19-2008

[eluser]GSV Sleeper Service[/eluser]
you'll have to use something like
Code:
$CI =& get_instance();
$CI->lang->load('curses','swahili');
...



Using language in a helper - El Forum - 05-19-2008

[eluser]wiredesignz[/eluser]
I submitted a language parser helper to the wiki (or was it Ignited Code) a while back, it may help you.

http://ellislab.com/forums/viewthread/76202/