blob: 9e5d9bdc9650adeabc21644a7eca3510e4c71dbc [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001###############
2Language Helper
3###############
4
5The Language Helper file contains functions that assist in working with
6language files.
7
Derek Jones49c43c42013-07-19 16:51:08 -07008.. contents::
9 :local:
10
11.. raw:: html
12
13 <div class="custom-index container"></div>
Derek Jones8ede1a22011-10-05 13:34:52 -050014
15Loading this Helper
16===================
17
Andrey Andreev53b8ef52012-11-08 21:38:53 +020018This helper is loaded using the following code::
Derek Jones8ede1a22011-10-05 13:34:52 -050019
20 $this->load->helper('language');
21
Derek Jones49c43c42013-07-19 16:51:08 -070022Available Functions
23===================
24
Derek Jones8ede1a22011-10-05 13:34:52 -050025The following functions are available:
26
Andrey Andreev53b8ef52012-11-08 21:38:53 +020027
Derek Jones49c43c42013-07-19 16:51:08 -070028.. function:: lang($line[, $for = ''[, $attributes = array()]])
Andrey Andreev53b8ef52012-11-08 21:38:53 +020029
Derek Jones49c43c42013-07-19 16:51:08 -070030 :param string $line: Language line key
31 :param string $for: HTML "for" attribute (ID of the element we're creating a label for)
32 :param array $attributes: Any additional HTML attributes
33 :returns: string
Derek Jones8ede1a22011-10-05 13:34:52 -050034
Derek Jones49c43c42013-07-19 16:51:08 -070035 This function returns a line of text from a loaded language file with
36 simplified syntax that may be more desirable for view files than
37 ``CI_Lang::line()``.
Derek Jones8ede1a22011-10-05 13:34:52 -050038
Derek Jones49c43c42013-07-19 16:51:08 -070039 Example::
Derek Jones8ede1a22011-10-05 13:34:52 -050040
Derek Jones49c43c42013-07-19 16:51:08 -070041 echo lang('language_key', 'form_item_id', array('class' => 'myClass');
42 // Outputs: <label for="form_item_id" class="myClass">Language line</label>