blob: cadf3c0cee2041fd8222493ac6d3885ac2af050a [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
Andrey Andreevcd3d9db2015-02-02 13:41:01 +020028.. php:function:: lang($line[, $for = ''[, $attributes = array()]])
Andrey Andreev53b8ef52012-11-08 21:38:53 +020029
Andrey Andreev3de130c2014-02-07 23:31:49 +020030 :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: HTML-formatted language line label
34 :rtype: string
Derek Jones8ede1a22011-10-05 13:34:52 -050035
Andrey Andreev3de130c2014-02-07 23:31:49 +020036 This function returns a line of text from a loaded language file with
37 simplified syntax that may be more desirable for view files than
38 ``CI_Lang::line()``.
Derek Jones8ede1a22011-10-05 13:34:52 -050039
Andrey Andreev3de130c2014-02-07 23:31:49 +020040 Example::
Derek Jones8ede1a22011-10-05 13:34:52 -050041
Andrey Andreev3de130c2014-02-07 23:31:49 +020042 echo lang('language_key', 'form_item_id', array('class' => 'myClass'));
43 // Outputs: <label for="form_item_id" class="myClass">Language line</label>